From: Tao Ma <tao.ma@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: fix a refcount condition checking
Date: Tue, 09 Feb 2010 09:15:42 +0800 [thread overview]
Message-ID: <4B70B73E.20306@oracle.com> (raw)
In-Reply-To: <20100209010639.GI1832@mail.oracle.com>
Joel Becker wrote:
> On Thu, Feb 04, 2010 at 04:20:18PM -0500, Wengang Wang wrote:
>> index 06ccf6a..77ebb6e 100644
>> --- a/fs/ocfs2/file.c
>> +++ b/fs/ocfs2/file.c
>> @@ -1775,7 +1775,7 @@ static int ocfs2_prepare_inode_for_write(struct dentry *dentry,
>> int *direct_io,
>> int *has_refcount)
>> {
>> - int ret = 0, meta_level = 0;
>> + int ret = 0, meta_level = 0, refcount = 0;
>> struct inode *inode = dentry->d_inode;
>> loff_t saved_pos, end;
>>
>> @@ -1834,6 +1834,7 @@ static int ocfs2_prepare_inode_for_write(struct dentry *dentry,
>> saved_pos,
>> count,
>> &meta_level);
>> + refcount = 1;
>> if (has_refcount)
>> *has_refcount = 1;
>> }
>
> Tao is right that this is redundant - we're setting two refcount
> bits, which is pointless.
> Here's the thing: we know that refcounted extents mean no direct
> io. Instead of adding your 'refcount' bit or Tao's comment, why not
> just clear direct_io right here?
>
> @@ -1834,6 +1834,8 @@ static int ocfs2_prepare_inode_for_write(struct dentry *dentry,
> saved_pos,
> count,
> &meta_level);
> if (has_refcount)
> *has_refcount = 1;
> + if (direct_io)
> + *direct_io = 0;
> }
>
> It's safe to clear if it exists - whether it was zero before, it must be
> zero now.
yeah, this is better.
btw, we also need to remove the latter lines.
- if (has_refcount && *has_refcount == 1) {
- *direct_io = 0;
- break;
-}
Regards,
Tao
prev parent reply other threads:[~2010-02-09 1:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-04 21:20 [Ocfs2-devel] [PATCH] ocfs2: fix a refcount condition checking Wengang Wang
2010-02-05 0:58 ` Tao Ma
2010-02-05 2:23 ` Wengang Wang
2010-02-05 2:30 ` Tao Ma
2010-02-05 3:21 ` Wengang Wang
2010-02-09 1:06 ` Joel Becker
2010-02-09 1:15 ` Tao Ma [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=4B70B73E.20306@oracle.com \
--to=tao.ma@oracle.com \
--cc=ocfs2-devel@oss.oracle.com \
/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.