linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 2/4] fat: skip cluster allocation on fallocated region
@ 2014-10-17 11:26 Namjae Jeon
  2014-10-23 15:30 ` OGAWA Hirofumi
  0 siblings, 1 reply; 2+ messages in thread
From: Namjae Jeon @ 2014-10-17 11:26 UTC (permalink / raw)
  To: OGAWA Hirofumi, Andrew Morton; +Cc: linux-fsdevel

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 <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v6 2/4] fat: skip cluster allocation on fallocated region
  2014-10-17 11:26 [PATCH v6 2/4] fat: skip cluster allocation on fallocated region Namjae Jeon
@ 2014-10-23 15:30 ` OGAWA Hirofumi
  0 siblings, 0 replies; 2+ messages in thread
From: OGAWA Hirofumi @ 2014-10-23 15:30 UTC (permalink / raw)
  To: Namjae Jeon; +Cc: Andrew Morton, linux-fsdevel

Namjae Jeon <namjae.jeon@samsung.com> writes:

> 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 <namjae.jeon@samsung.com>
> Signed-off-by: Amit Sahrawat <a.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)

iblock and i_blocks have different unit. iblock == s_blocksize, 
i_blocks == 9 alwasy.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-23 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-17 11:26 [PATCH v6 2/4] fat: skip cluster allocation on fallocated region Namjae Jeon
2014-10-23 15:30 ` OGAWA Hirofumi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).