Discussion:
[PATCH v6 2/4] fat: skip cluster allocation on fallocated region
(too old to reply)
Namjae Jeon
2014-10-17 11:26:35 UTC
Permalink
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)
--
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
OGAWA Hirofumi
2014-10-23 15:30:50 UTC
Permalink
Post by Namjae Jeon
Skip new cluster allocation after checking i_blocks limit in _fat_get_block,
because the blocks are already allocated in fallocated region.
---
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)
iblock and i_blocks have different unit. iblock == s_blocksize,
i_blocks == 9 alwasy.
--
OGAWA Hirofumi <***@mail.parknet.co.jp>
--
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
Loading...