From mboxrd@z Thu Jan 1 00:00:00 1970 From: Namjae Jeon Subject: RE: [PATCH v7 1/4] fat: add fat_fallocate operation Date: Tue, 02 Dec 2014 10:30:13 +0900 Message-ID: <000001d00dcf$85176a40$8f463ec0$@samsung.com> References: <000101cffed2$1511d070$3f357150$@samsung.com> <877fyixa6u.fsf@devron.myhome.or.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: 'Andrew Morton' , linux-fsdevel@vger.kernel.org To: 'OGAWA Hirofumi' Return-path: Received: from mailout4.samsung.com ([203.254.224.34]:50529 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754196AbaLBBaP (ORCPT ); Mon, 1 Dec 2014 20:30:15 -0500 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NFX00MAALIDJU60@mailout4.samsung.com> for linux-fsdevel@vger.kernel.org; Tue, 02 Dec 2014 10:30:14 +0900 (KST) In-reply-to: <877fyixa6u.fsf@devron.myhome.or.jp> Content-language: ko Sender: linux-fsdevel-owner@vger.kernel.org List-ID: > > Namjae Jeon writes: > > > +static int __fat_write_inode(struct inode *inode, int wait); > > static void fat_evict_inode(struct inode *inode) > > { > > truncate_inode_pages_final(&inode->i_data); > > if (!inode->i_nlink) { > > inode->i_size = 0; > > fat_truncate_blocks(inode, 0); > > + } else { > > + /* Release unwritten fallocated blocks on inode eviction. */ > > + if ((inode->i_blocks << 9) > > > + round_up(MSDOS_I(inode)->mmu_private, > > + inode->i_sb->s_blocksize)) { > > Don't we need to check alignment of cluster size here, not blocksize? > Otherwise, looks like we call write_inode() without actual truncate. > > (BTW, IMHO, Adding own static function for this, would be easier to > read.) Yes, We need to align with cluster size. I will fix it. Thanks for review! > > > + int err; > > + > > + fat_truncate_blocks(inode, MSDOS_I(inode)->mmu_private); > > + /* Fallocate results in updating the i_start/iogstart > > + * for the zero byte file. So, make it return to > > + * original state during evict and commit it to avoid > > + * any corruption on the next access to the cluster > > + * chain for the file. > > + */ > > + err = __fat_write_inode(inode, inode_needs_sync(inode)); > > + if (err) { > > + fat_msg(inode->i_sb, KERN_WARNING, "Failed to " > > + "update on disk inode for unused fallocated " > > + "blocks, inode could be corrupted. Please run " > > + "fsck"); > > + } > > + } > -- > OGAWA Hirofumi