Namjae Jeon
2014-10-17 11:26:35 UTC
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 <***@samsung.com>
Signed-off-by: Amit Sahrawat <***@samsung.com>
---
fs/fat/inode.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index acb45ce..20e9fe5 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -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)
because the blocks are already allocated in fallocated region.
Signed-off-by: Namjae Jeon <***@samsung.com>
Signed-off-by: Amit Sahrawat <***@samsung.com>
---
fs/fat/inode.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index acb45ce..20e9fe5 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -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)
--
1.7.11-rc0
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
1.7.11-rc0
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html