From patchwork Mon Mar 29 08:28:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "M. Mohan Kumar" X-Patchwork-Id: 88925 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2T8TIcm014030 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 29 Mar 2010 08:29:54 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NwALN-0007jM-Dd; Mon, 29 Mar 2010 08:29:09 +0000 Received: from sfi-mx-2.v28.ch3.sourceforge.com ([172.29.28.122] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NwALM-0007jF-Fg for v9fs-developer@lists.sourceforge.net; Mon, 29 Mar 2010 08:29:08 +0000 Received-SPF: softfail (sfi-mx-2.v28.ch3.sourceforge.com: transitioning domain of in.ibm.com does not designate 122.248.162.8 as permitted sender) client-ip=122.248.162.8; envelope-from=mohan@in.ibm.com; helo=e28smtp08.in.ibm.com; Received: from e28smtp08.in.ibm.com ([122.248.162.8]) by sfi-mx-2.v28.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1NwALJ-0000jQ-PI for v9fs-developer@lists.sourceforge.net; Mon, 29 Mar 2010 08:29:08 +0000 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by e28smtp08.in.ibm.com (8.14.3/8.13.1) with ESMTP id o2T7d0Ik024913 for ; Mon, 29 Mar 2010 13:09:00 +0530 Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o2T8SvFL3018814 for ; Mon, 29 Mar 2010 13:58:57 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o2T8Svri000527 for ; Mon, 29 Mar 2010 19:28:57 +1100 Received: from localhost.localdomain (K50wks273882wss.in.ibm.com [9.124.35.44]) by d28av04.in.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id o2T8SvZ8000524 for ; Mon, 29 Mar 2010 19:28:57 +1100 From: "M. Mohan Kumar" To: v9fs-developer@lists.sourceforge.net Date: Mon, 29 Mar 2010 13:58:56 +0530 Message-Id: <1269851336-28337-1-git-send-email-mohan@in.ibm.com> X-Mailer: git-send-email 1.6.6.1 X-Spam-Score: 0.7 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) X-Headers-End: 1NwALJ-0000jQ-PI Subject: [V9fs-developer] [PATCH] Use existing stat info while doing setattr 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.3 (demeter.kernel.org [140.211.167.41]); Mon, 29 Mar 2010 08:29:54 +0000 (UTC) diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index ae83967..da56571 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -841,7 +841,7 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) int retval; struct v9fs_session_info *v9ses; struct p9_fid *fid; - struct p9_wstat wstat; + struct p9_wstat *stat; P9_DPRINTK(P9_DEBUG_VFS, "\n"); retval = -EPERM; @@ -850,31 +850,35 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) if(IS_ERR(fid)) return PTR_ERR(fid); - v9fs_blank_wstat(&wstat); + stat = p9_client_stat(fid); + if (IS_ERR(stat)) + return PTR_ERR(stat); + if (iattr->ia_valid & ATTR_MODE) - wstat.mode = unixmode2p9mode(v9ses, iattr->ia_mode); + stat->mode = unixmode2p9mode(v9ses, iattr->ia_mode); if (iattr->ia_valid & ATTR_MTIME) - wstat.mtime = iattr->ia_mtime.tv_sec; + stat->mtime = iattr->ia_mtime.tv_sec; if (iattr->ia_valid & ATTR_ATIME) - wstat.atime = iattr->ia_atime.tv_sec; + stat->atime = iattr->ia_atime.tv_sec; if (iattr->ia_valid & ATTR_SIZE) - wstat.length = iattr->ia_size; + stat->length = iattr->ia_size; if (v9fs_proto_dotu(v9ses)) { if (iattr->ia_valid & ATTR_UID) - wstat.n_uid = iattr->ia_uid; + stat->n_uid = iattr->ia_uid; if (iattr->ia_valid & ATTR_GID) - wstat.n_gid = iattr->ia_gid; + stat->n_gid = iattr->ia_gid; } - retval = p9_client_wstat(fid, &wstat); + retval = p9_client_wstat(fid, stat); if (retval >= 0) retval = inode_setattr(dentry->d_inode, iattr); + kfree(stat); return retval; }