From mboxrd@z Thu Jan 1 00:00:00 1970 From: Namjae Jeon Subject: [PATCH v6 2/4] fat: skip cluster allocation on fallocated region Date: Fri, 17 Oct 2014 20:26:35 +0900 Message-ID: <006d01cfe9fd$35bcff50$a136fdf0$@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org To: OGAWA Hirofumi , Andrew Morton Return-path: Received: from mailout4.samsung.com ([203.254.224.34]:28276 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752543AbaJQL0g (ORCPT ); Fri, 17 Oct 2014 07:26:36 -0400 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NDL00MCC6GB5YC0@mailout4.samsung.com> for linux-fsdevel@vger.kernel.org; Fri, 17 Oct 2014 20:26:35 +0900 (KST) Content-language: ko Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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) -- 1.7.11-rc0