From mboxrd@z Thu Jan 1 00:00:00 1970 From: Seunghun Lee Subject: Re: [PATCH] fat: Simplify calc_fat_clusters code Date: Wed, 03 Sep 2014 01:41:06 +0900 Message-ID: <5405F322.8080608@gmail.com> References: <1409664810-31960-1-git-send-email-waydi1@gmail.com> <87k35m3ufa.fsf@devron.myhome.or.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org To: OGAWA Hirofumi Return-path: In-Reply-To: <87k35m3ufa.fsf@devron.myhome.or.jp> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On 09/03/2014 12:37 AM, OGAWA Hirofumi wrote: > Seunghun Lee writes: > >> 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; >> } > When sbi->fat_bits == 12, it doesn't work, right? (there is the remainder) > > Thanks. Yes, you are right. I didn't think about the remainder. Thanks.