From: "J. Bruce Fields" <bfields@fieldses.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-fsdevel@vger.kernel.org, nfs@lists.sourceforge.net,
Marc Eshel <eshel@almaden.ibm.com>
Subject: Re: [PATCH 2/14] locks: factor out generic/filesystem switch from test_lock
Date: Sat, 3 Feb 2007 20:48:44 -0500 [thread overview]
Message-ID: <20070204014844.GG7588@fieldses.org> (raw)
In-Reply-To: <20070203085025.GB18828@infradead.org>
On Sat, Feb 03, 2007 at 08:50:25AM +0000, Christoph Hellwig wrote:
> > +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.
OK, done.
>
> > + 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.
That's a good idea, thanks; done.
Actually, I wonder if there's any reason we couldn't also just give
posix_test_lock() the same interface as ->lock? (The latter uses the
same file_lock argument for the input and (in the case where it finds
a conflicting lock) the output, where the former uses an extra argument
to pass back the lock.) That'd make this a little simpler too.
> 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.
OK!--b.
next prev parent reply other threads:[~2007-02-04 1:48 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <11704808501171-git-send-email->
[not found] ` <11704808502512-git-send-email->
[not found] ` <11704808513862-git-send-email->
[not found] ` <1170480851972-git-send-email->
[not found] ` <11704808513070-git-send-email->
[not found] ` <117048085185-git-send-email->
[not found] ` <11704808513263-git-send-email->
[not found] ` <11704808513185-git-send-email->
[not found] ` <11704808511238-git-send-email->
[not found] ` <11704808513085-git-send-email->
[not found] ` <11704808521765-git-send-email->
[not found] ` <11704808523686-git-send-email->
2007-02-03 5:33 ` [PATCH 1/14] locks: always unlock on close J. Bruce Fields
2007-02-03 5:33 ` J. Bruce Fields
2007-02-03 5:33 ` J. Bruce Fields
2007-02-03 5:33 ` [PATCH 2/14] locks: factor out generic/filesystem switch from test_lock J. Bruce Fields
2007-02-03 5:33 ` J. Bruce Fields
2007-02-03 5:33 ` J. Bruce Fields
2007-02-03 8:50 ` Christoph Hellwig
2007-02-04 1:48 ` J. Bruce Fields [this message]
2007-02-04 8:41 ` Christoph Hellwig
2007-02-04 0:32 ` [NFS] " Trond Myklebust
2007-02-04 1:52 ` J. Bruce Fields
2007-02-03 5:33 ` [PATCH 3/14] locks: factor out generic/filesystem switch from setlock code J. Bruce Fields
2007-02-03 5:33 ` J. Bruce Fields
2007-02-03 5:33 ` J. Bruce Fields
2007-02-03 8:51 ` Christoph Hellwig
2007-02-03 5:16 ` Brad Boyer
2007-02-04 2:27 ` J. Bruce Fields
2007-02-04 8:37 ` Christoph Hellwig
2007-02-03 21:27 ` Brad Boyer
2007-02-04 1:58 ` J. Bruce Fields
2007-02-03 5:34 ` [PATCH 4/14] locks: add locking function that returns conflicting lock J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 8:54 ` Christoph Hellwig
2007-02-04 2:02 ` J. Bruce Fields
2007-02-03 5:34 ` [PATCH 5/14] locks: add fl_notify arguments for asynchronous lock return J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` [PATCH 6/14] locks: add lock cancel command J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` [PATCH 7/14] nfsd4: Convert NFSv4 to new lock interface J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` [PATCH 8/14] lockd: save lock state on deferral J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` [PATCH 9/14] lockd: handle fl_notify callbacks J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-04 0:40 ` [NFS] " Trond Myklebust
2007-02-04 2:10 ` J. Bruce Fields
2007-02-03 5:34 ` [PATCH 10/14] lockd: pass cookie in nlmsvc_testlock J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` [PATCH 11/14] lockd: handle test_lock deferrals J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` [PATCH 12/14] lockd: always preallocate block in nlmsvc_lock() J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` [PATCH 13/14] lockd: add code to handle deferred lock requests J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` [PATCH 14/14] gfs2: nfs lock support for gfs2 J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
2007-02-03 5:34 ` J. Bruce Fields
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070204014844.GG7588@fieldses.org \
--to=bfields@fieldses.org \
--cc=eshel@almaden.ibm.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=nfs@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.