Re: [PATCH] fat: Simplify calc_fat_clusters code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/03/2014 12:37 AM, OGAWA Hirofumi wrote:
> Seunghun Lee <waydi1@xxxxxxxxx> 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.

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux