LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH resend] ext2/3/4: convert byte order of constant instead of variable
@ 2008-02-10 10:10 Marcin Slusarz
  2008-02-14 22:20 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Marcin Slusarz @ 2008-02-10 10:10 UTC (permalink / raw)
  To: linux-ext4; +Cc: LKML

convert byte order of constant instead of variable
which can be done at compile time (vs run time)
ext3/4 bits are #if 0'ed, but someone might copy this code into other places

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
---
 fs/ext2/super.c |    8 +++-----
 fs/ext3/super.c |    2 +-
 fs/ext4/super.c |    2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 088b011..108f739 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -51,8 +51,7 @@ void ext2_error (struct super_block * sb, const char * function,
 
 	if (!(sb->s_flags & MS_RDONLY)) {
 		sbi->s_mount_state |= EXT2_ERROR_FS;
-		es->s_state =
-			cpu_to_le16(le16_to_cpu(es->s_state) | EXT2_ERROR_FS);
+		es->s_state |= cpu_to_le16(EXT2_ERROR_FS);
 		ext2_sync_super(sb, es);
 	}
 
@@ -1126,10 +1125,9 @@ void ext2_write_super (struct super_block * sb)
 	if (!(sb->s_flags & MS_RDONLY)) {
 		es = EXT2_SB(sb)->s_es;
 
-		if (le16_to_cpu(es->s_state) & EXT2_VALID_FS) {
+		if (es->s_state & cpu_to_le16(EXT2_VALID_FS)) {
 			ext2_debug ("setting valid to 0\n");
-			es->s_state = cpu_to_le16(le16_to_cpu(es->s_state) &
-						  ~EXT2_VALID_FS);
+			es->s_state &= cpu_to_le16(~EXT2_VALID_FS);
 			es->s_free_blocks_count = cpu_to_le32(ext2_count_free_blocks(sb));
 			es->s_free_inodes_count = cpu_to_le32(ext2_count_free_inodes(sb));
 			es->s_mtime = cpu_to_le32(get_seconds());
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 8e02cbf..6c84e6b 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -1218,7 +1218,7 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es,
                    inconsistencies, to force a fsck at reboot.  But for
                    a plain journaled filesystem we can keep it set as
                    valid forever! :) */
-	es->s_state = cpu_to_le16(le16_to_cpu(es->s_state) & ~EXT3_VALID_FS);
+	es->s_state &= cpu_to_le16(~EXT3_VALID_FS);
 #endif
 	if (!(__s16) le16_to_cpu(es->s_max_mnt_count))
 		es->s_max_mnt_count = cpu_to_le16(EXT3_DFL_MAX_MNT_COUNT);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 93beb86..5ceeb90 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1387,7 +1387,7 @@ static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es,
 		 * a plain journaled filesystem we can keep it set as
 		 * valid forever! :)
 		 */
-	es->s_state = cpu_to_le16(le16_to_cpu(es->s_state) & ~EXT4_VALID_FS);
+	es->s_state &= cpu_to_le16(~EXT4_VALID_FS);
 #endif
 	if (!(__s16) le16_to_cpu(es->s_max_mnt_count))
 		es->s_max_mnt_count = cpu_to_le16(EXT4_DFL_MAX_MNT_COUNT);
-- 
1.5.3.7


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH resend] ext2/3/4: convert byte order of constant instead of variable
  2008-02-10 10:10 [PATCH resend] ext2/3/4: convert byte order of constant instead of variable Marcin Slusarz
@ 2008-02-14 22:20 ` Andrew Morton
  2008-02-15  0:27   ` Mingming Cao
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2008-02-14 22:20 UTC (permalink / raw)
  To: Marcin Slusarz; +Cc: linux-ext4, linux-kernel

On Sun, 10 Feb 2008 11:10:15 +0100
Marcin Slusarz <marcin.slusarz@gmail.com> wrote:

>  fs/ext2/super.c |    8 +++-----
>  fs/ext3/super.c |    2 +-
>  fs/ext4/super.c |    2 +-

Please don't bundle the filesystem patches in this manner.  I split
it into three patches.

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH resend] ext2/3/4: convert byte order of constant instead of variable
  2008-02-14 22:20 ` Andrew Morton
@ 2008-02-15  0:27   ` Mingming Cao
  0 siblings, 0 replies; 3+ messages in thread
From: Mingming Cao @ 2008-02-15  0:27 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Marcin Slusarz, linux-ext4, linux-kernel, tytso

On Thu, 2008-02-14 at 14:20 -0800, Andrew Morton wrote:
> On Sun, 10 Feb 2008 11:10:15 +0100
> Marcin Slusarz <marcin.slusarz@gmail.com> wrote:
> 
> >  fs/ext2/super.c |    8 +++-----
> >  fs/ext3/super.c |    2 +-
> >  fs/ext4/super.c |    2 +-
> 
> Please don't bundle the filesystem patches in this manner.  I split
> it into three patches.
> 
Andrew, Ted,

I added the ext4 patch in the ext4 patch queue.

Regards,
Mingming



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-15  0:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-10 10:10 [PATCH resend] ext2/3/4: convert byte order of constant instead of variable Marcin Slusarz
2008-02-14 22:20 ` Andrew Morton
2008-02-15  0:27   ` Mingming Cao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).