fat: instead of constant number, use the i_blkbits of struct inode to calculate the number of blocks
Subsystems (2)
PATCH 1/1 fat: instead of constant number, use the i_blkbits of struct inode to calculate the number of blocks
To calculate the number of blocks from the number of clusters, use the i_blkbits of struct inode instead of 9.
Signed-off-by Hyeoncheol Lee <[email protected]>
--- fs/fat/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fat/misc.c +1 -1
@@ -156,7 +156,7 @@ int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster) (llu)(inode->i_blocks >> (sbi->cluster_bits - 9)));fat_cache_inval_inode (inode); } - inode->i_blocks += nr_cluster << (sbi->cluster_bits -9 ); + inode->i_blocks += nr_cluster << (sbi->cluster_bits - inode->i_blkbits);return 0 ; }
Signature · 1 line
1.7.9.5
OGAWA Hirofumi
maintainerQuoted 13 lines · Hyeoncheol Lee
To calculate the number of blocks from the number of clusters, use the
i_blkbitsof struct inode instead of 9.Signed-off-by Hyeoncheol Lee <[email protected]>--- fs/fat/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/fat/misc.c +0
-0
fs/fat/misc.c int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster) · line 159
Quoted 5 lines
fs/fat/misc.c +1
-1@@ -156,7 +156,7 @@ int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster) (llu)(inode->i_blocks >> (sbi->cluster_bits - 9)));fat_cache_inval_inode (inode); } - inode->i_blocks += nr_cluster << (sbi->cluster_bits -9 ); + inode->i_blocks += nr_cluster << (sbi->cluster_bits - inode->i_blkbits);
No. Unit of ->i_blocks is 512bytes always. So, 9 is right number.
Quoted 3 lines
fs/fat/misc.c +0
-0return 0 ; }
Signature · 1 line
OGAWA Hirofumi <[email protected]>