Skip to contentSkip to conversation

fat: instead of constant number, use the i_blkbits of struct inode to calculate the number of blocks

PATCH In review Hyeoncheol Lee 2 participants 2 messages Feb 19, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

---
 fs/fat/misc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fat/misc.c +1 -1
index 6d93360..ccdf663 100644
@@ -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
maintainer
#1 lore raw
Quoted 13 lines · Hyeoncheol Lee

To calculate the number of blocks from the number of clusters, use the i_blkbits of struct inode instead of 9.

---
 fs/fat/misc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fat/misc.c +0 -0
index 6d93360..ccdf663 100644

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 -0
 	return 0;
 }
Signature · 1 line
OGAWA Hirofumi <[email protected]>