From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: "David M. Richter" <richterd@citi.umich.edu>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2/4] leases: when unlocking, skip locking-related steps
Date: Thu, 24 Apr 2008 16:41:45 -0400 [thread overview]
Message-ID: <20080424204145.GF18573@fieldses.org> (raw)
In-Reply-To: <D5246585-B3C0-4EDF-BEEE-E72FD9BB0023@oracle.com>
On Thu, Apr 24, 2008 at 10:32:39AM -0400, Chuck Lever wrote:
> Hi David-
>
> On Apr 23, 2008, at 4:29 PM, David M. Richter wrote:
>> In generic_setlease(), we don't need to allocate a new struct
>> file_lock
>> or check for readers or writers when called with F_UNLCK.
>
> Since you re-ordered the locks_alloc_lock call in the next patch, it
> seems to me this would look a lot cleaner with a switch statement
> instead of all these "if (arg == F_FOO)".
This could certainly be cleaner, but I took a quick look and didn't see
how to do what you were suggesting--probably just me being dense.
David's changes seem reasonable enough on their own, so I'd take any
cleanup as an incremental patch on top.
--b.
>
>> Signed-off-by: David M. Richter <richterd@citi.umich.edu>
>> ---
>> fs/locks.c | 24 +++++++++++++-----------
>> 1 files changed, 13 insertions(+), 11 deletions(-)
>>
>> diff --git a/fs/locks.c b/fs/locks.c
>> index b9f3a0b..da1d0dd 100644
>> --- a/fs/locks.c
>> +++ b/fs/locks.c
>> @@ -1367,18 +1367,20 @@ int generic_setlease(struct file *filp, long
>> arg, struct file_lock **flp)
>>
>> lease = *flp;
>>
>> - error = -EAGAIN;
>> - if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0))
>> - goto out;
>> - if ((arg == F_WRLCK)
>> - && ((atomic_read(&dentry->d_count) > 1)
>> - || (atomic_read(&inode->i_count) > 1)))
>> - goto out;
>> + if (arg != F_UNLCK) {
>> + error = -EAGAIN;
>> + if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0))
>> + goto out;
>> + if ((arg == F_WRLCK)
>> + && ((atomic_read(&dentry->d_count) > 1)
>> + || (atomic_read(&inode->i_count) > 1)))
>> + goto out;
>>
>> - error = -ENOMEM;
>> - new_fl = locks_alloc_lock();
>> - if (new_fl == NULL)
>> - goto out;
>> + error = -ENOMEM;
>> + new_fl = locks_alloc_lock();
>> + if (new_fl == NULL)
>> + goto out;
>> + }
>>
>> /*
>> * At this point, we know that if there is an exclusive
>> --
>> 1.5.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-
>> fsdevel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> --
> Chuck Lever
> chuck[dot]lever[at]oracle[dot]com
>
>
>
prev parent reply other threads:[~2008-04-24 20:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-23 20:28 [PATCH 1/4] leases: fix a return-value mixup David M. Richter
2008-04-23 20:29 ` [PATCH 2/4] leases: when unlocking, skip locking-related steps David M. Richter
2008-04-23 20:29 ` [PATCH 3/4] leases: move lock allocation earlier in generic_setlease() David M. Richter
2008-04-23 20:29 ` [PATCH 4/4] leases: remove unneeded variable from fcntl_setlease() David M. Richter
2008-04-23 22:52 ` J. Bruce Fields
2008-04-24 14:32 ` [PATCH 2/4] leases: when unlocking, skip locking-related steps Chuck Lever
2008-04-24 20:41 ` J. Bruce Fields [this message]
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=20080424204145.GF18573@fieldses.org \
--to=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=richterd@citi.umich.edu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).