fat: skip cluster allocation on fallocated region
Subsystems (2)
PATCH v6 2/4 fat: skip cluster allocation on fallocated region
Skip new cluster allocation after checking i_blocks limit in _fat_get_block, because the blocks are already allocated in fallocated region.
Signed-off-by Namjae Jeon <[email protected]>
Signed-off-by Amit Sahrawat <[email protected]>
--- fs/fat/inode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/fat/inode.c +6 -1
@@ -144,7 +144,12 @@ static inline int __fat_get_block(struct inode *inode, sector_t iblock, } offset = (unsigned long )iblock & (sbi->sec_per_clus -1 ); -if (!offset) { +/* +* allocate a cluster according to the following. +* 1) no more available blocks +* 2) not part of fallocate region +*/ +if (!offset && !(iblock < (sector_t )inode->i_blocks)) {/* TODO: multiple cluster allocation would be desirable. */ err =fat_add_cluster (inode);if (err)
Signature · 1 line
1.7.11-rc0
OGAWA Hirofumi
maintainerQuoted 17 lines · Namjae Jeon
Skip new cluster allocation after checking
i_blockslimit in_fat_get_block, because the blocks are already allocated in fallocated region.Signed-off-by Namjae Jeon <[email protected]>Signed-off-by Amit Sahrawat <[email protected]>--- fs/fat/inode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)fs/fat/inode.c +0
-0@@ -144,7 +144,12 @@ static inline int __fat_get_block(struct inode *inode, sector_t iblock, } offset = (unsigned long )iblock & (sbi->sec_per_clus -1 );
fs/fat/inode.c static inline int __fat_get_block(struct inode *inode, sector_t iblock, · line 155
Quoted 10 lines
fs/fat/inode.c +6
-1-if (!offset) { +/* +* allocate a cluster according to the following. +* 1) no more available blocks +* 2) not part of fallocate region +*/ +if (!offset && !(iblock < (sector_t )inode->i_blocks)) {/* TODO: multiple cluster allocation would be desirable. */ err =fat_add_cluster (inode);if (err)
iblock and i_blocks have different unit. iblock == s_blocksize, i_blocks == 9 alwasy.
Signature · 1 line
OGAWA Hirofumi <[email protected]>