From mboxrd@z Thu Jan 1 00:00:00 1970 From: OGAWA Hirofumi Subject: Re: [PATCH v6 2/4] fat: skip cluster allocation on fallocated region Date: Fri, 24 Oct 2014 00:30:50 +0900 Message-ID: <87k33q951x.fsf@devron.myhome.or.jp> References: <006d01cfe9fd$35bcff50$a136fdf0$@samsung.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Andrew Morton , linux-fsdevel@vger.kernel.org To: Namjae Jeon Return-path: Received: from mail.parknet.co.jp ([210.171.160.6]:44952 "EHLO mail.parknet.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751362AbaJWPax (ORCPT ); Thu, 23 Oct 2014 11:30:53 -0400 In-Reply-To: <006d01cfe9fd$35bcff50$a136fdf0$@samsung.com> (Namjae Jeon's message of "Fri, 17 Oct 2014 20:26:35 +0900") Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Namjae Jeon 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 > Signed-off-by: Amit Sahrawat > --- > 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