From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] gfs2: gfs2_dir_get_hash_table(): avoiding deferred vfree() is easy here...
Date: Thu, 20 Nov 2014 08:13:03 -0500 (EST) [thread overview]
Message-ID: <38038928.16891302.1416489183602.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20141120051947.GG7996@ZenIV.linux.org.uk>
----- Original Message -----
> vfree() is allowed under spinlock these days, but it's cheaper when
> it doesn't step into deferred case and here it's very easy to avoid.
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> fs/gfs2/dir.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
> index c247fed..c5a34f0 100644
> --- a/fs/gfs2/dir.c
> +++ b/fs/gfs2/dir.c
> @@ -370,11 +370,12 @@ static __be64 *gfs2_dir_get_hash_table(struct
> gfs2_inode *ip)
> }
>
> spin_lock(&inode->i_lock);
> - if (ip->i_hash_cache)
> - kvfree(hc);
> - else
> + if (likely(!ip->i_hash_cache)) {
> ip->i_hash_cache = hc;
> + hc = NULL;
> + }
> spin_unlock(&inode->i_lock);
> + kvfree(hc);
>
> return ip->i_hash_cache;
> }
> --
> 1.7.10.4
>
>
ACK
Bob Peterson
Red Hat File Systems
next prev parent reply other threads:[~2014-11-20 13:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-20 5:19 [Cluster-devel] gfs2: gfs2_dir_get_hash_table(): avoiding deferred vfree() is easy here Al Viro
2014-11-20 13:13 ` Bob Peterson [this message]
2014-11-20 17:19 ` Steven Whitehouse
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=38038928.16891302.1416489183602.JavaMail.zimbra@redhat.com \
--to=rpeterso@redhat.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 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).