From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH 2/14] locks: factor out generic/filesystem switch from test_lock Date: Sat, 3 Feb 2007 08:50:25 +0000 Message-ID: <20070203085025.GB18828@infradead.org> References: <5cdd83858bf5c75e14742bbd03b462f5ec4997fe.1170479265.git.bfields@citi.umich.edu> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, nfs@lists.sourceforge.net, Marc Eshel To: "J. Bruce Fields" Return-path: Content-Disposition: inline In-Reply-To: <5cdd83858bf5c75e14742bbd03b462f5ec4997fe.1170479265.git.bfields@citi.umich.edu> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nfs-bounces@lists.sourceforge.net Errors-To: nfs-bounces@lists.sourceforge.net List-Id: linux-fsdevel.vger.kernel.org > +int vfs_test_lock(struct file *filp, struct file_lock *fl, struct file_lock *conf) Please make sure to add linebreaks after at most 80 characters. > + error = vfs_test_lock(filp, &file_lock, &cfl); > + if (error) > + goto out; > + fl = (cfl.fl_type == F_UNLCK ? NULL : &cfl); > flock.l_type = F_UNLCK; > if (fl != NULL) { This code snippled is more than ugly. fl is only checked for equality once so you should reformulate that check using the actual type check: if (cfl.fl_type != F_UNLCK) { That also allows you to move the flock.l_type = fl->fl_type; out of the if statement later on. In fact that copying out should proably move into posix_lock_to_flock and posix_lock_to_fock64 helpers similar to the flock_to_posix_lock and flock64_to_posix_lock helpers we have for the other way around. ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ NFS maillist - NFS@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nfs