From patchwork Thu Feb 17 18:01:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 571241 X-Patchwork-Delegate: ericvh@gmail.com Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1HI2nUX009096 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 17 Feb 2011 18:03:10 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.74) (envelope-from ) id 1Pq8BU-0004bR-Nd; Thu, 17 Feb 2011 18:02:32 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.74) (envelope-from ) id 1Pq8BT-0004bL-Iz for v9fs-developer@lists.sourceforge.net; Thu, 17 Feb 2011 18:02:31 +0000 X-ACL-Warn: Received: from e23smtp01.au.ibm.com ([202.81.31.143]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.74) id 1Pq8BS-0000Gf-BI for v9fs-developer@lists.sourceforge.net; Thu, 17 Feb 2011 18:02:31 +0000 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [202.81.31.245]) by e23smtp01.au.ibm.com (8.14.4/8.13.1) with ESMTP id p1HHwafR010871 for ; Fri, 18 Feb 2011 04:58:36 +1100 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p1HI2HCS1626336 for ; Fri, 18 Feb 2011 05:02:17 +1100 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p1HI2H1h013096 for ; Fri, 18 Feb 2011 05:02:17 +1100 Received: from skywalker.ibm.com ([9.124.88.70]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p1HI2Dcu013014; Fri, 18 Feb 2011 05:02:15 +1100 From: "Aneesh Kumar K.V" To: v9fs-developer@lists.sourceforge.net Date: Thu, 17 Feb 2011 23:31:52 +0530 Message-Id: <1297965725-25603-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1297965725-25603-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1297965725-25603-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-Spam-Score: 0.7 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.7 AWL AWL: From: address is in the auto white-list X-Headers-End: 1Pq8BS-0000Gf-BI Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [V9fs-developer] [PATCH 01/14] fs/9p: Fix inode i_size update in file_write X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: v9fs-developer-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 17 Feb 2011 18:03:10 +0000 (UTC) diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index e9cd277..a56a33b 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -451,6 +451,7 @@ v9fs_file_write_internal(struct inode *inode, struct p9_fid *fid, char *data, size_t count, loff_t *offset) { int n; + loff_t i_size; size_t total = 0; struct p9_client *clnt; loff_t origin = *offset; @@ -475,10 +476,12 @@ v9fs_file_write_internal(struct inode *inode, struct p9_fid *fid, char *data, invalidate_inode_pages2_range(inode->i_mapping, pg_start, pg_end); *offset += total; - i_size_write(inode, i_size_read(inode) + total); - inode->i_blocks = (i_size_read(inode) + 512 - 1) >> 9; + i_size = i_size_read(inode); + if (*offset > i_size) { + inode_add_bytes(inode, *offset - i_size); + i_size_write(inode, *offset); + } } - if (n < 0) return n;