All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fat: Simplify calc_fat_clusters code
@ 2014-09-02 13:33 Seunghun Lee
  2014-09-02 15:37 ` OGAWA Hirofumi
  0 siblings, 1 reply; 3+ messages in thread
From: Seunghun Lee @ 2014-09-02 13:33 UTC (permalink / raw)
  To: hirofumi; +Cc: linux-kernel, linux-fsdevel, Seunghun Lee

Code for fat12 and fat16/32 can be merged to one.

Signed-off-by: Seunghun Lee <waydi1@gmail.com>
---
 fs/fat/inode.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 756aead..6992dea 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -1307,12 +1307,9 @@ static unsigned long calc_fat_clusters(struct super_block *sb)
 	struct msdos_sb_info *sbi = MSDOS_SB(sb);
 
 	/* Divide first to avoid overflow */
-	if (sbi->fat_bits != 12) {
-		unsigned long ent_per_sec = sb->s_blocksize * 8 / sbi->fat_bits;
-		return ent_per_sec * sbi->fat_length;
-	}
+	unsigned long ent_per_sec = sb->s_blocksize * 8 / sbi->fat_bits;
 
-	return sbi->fat_length * sb->s_blocksize * 8 / sbi->fat_bits;
+	return ent_per_sec * sbi->fat_length;
 }
 
 static bool fat_bpb_is_zero(struct fat_boot_sector *b)
-- 
1.7.9.5


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

end of thread, other threads:[~2014-09-02 16:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-02 13:33 [PATCH] fat: Simplify calc_fat_clusters code Seunghun Lee
2014-09-02 15:37 ` OGAWA Hirofumi
2014-09-02 16:41   ` Seunghun Lee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.