* gfs2: gfs2_dir_get_hash_table(): avoiding deferred vfree() is easy here...
@ 2014-11-20 5:19 Al Viro
2014-11-20 13:13 ` [Cluster-devel] " Bob Peterson
2014-11-20 17:19 ` Steven Whitehouse
0 siblings, 2 replies; 3+ messages in thread
From: Al Viro @ 2014-11-20 5:19 UTC (permalink / raw)
To: linux-kernel; +Cc: cluster-devel
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Cluster-devel] gfs2: gfs2_dir_get_hash_table(): avoiding deferred vfree() is easy here...
2014-11-20 5:19 gfs2: gfs2_dir_get_hash_table(): avoiding deferred vfree() is easy here Al Viro
@ 2014-11-20 13:13 ` Bob Peterson
2014-11-20 17:19 ` Steven Whitehouse
1 sibling, 0 replies; 3+ messages in thread
From: Bob Peterson @ 2014-11-20 13:13 UTC (permalink / raw)
To: Al Viro; +Cc: linux-kernel, cluster-devel
----- 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Cluster-devel] gfs2: gfs2_dir_get_hash_table(): avoiding deferred vfree() is easy here...
2014-11-20 5:19 gfs2: gfs2_dir_get_hash_table(): avoiding deferred vfree() is easy here Al Viro
2014-11-20 13:13 ` [Cluster-devel] " Bob Peterson
@ 2014-11-20 17:19 ` Steven Whitehouse
1 sibling, 0 replies; 3+ messages in thread
From: Steven Whitehouse @ 2014-11-20 17:19 UTC (permalink / raw)
To: Al Viro, linux-kernel; +Cc: cluster-devel
Hi,
All five patches now in the GFS2 -nmw tree. Thanks,
Steve.
On 20/11/14 05:19, Al Viro wrote:
> 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;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-20 17:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-20 5:19 gfs2: gfs2_dir_get_hash_table(): avoiding deferred vfree() is easy here Al Viro
2014-11-20 13:13 ` [Cluster-devel] " Bob Peterson
2014-11-20 17:19 ` Steven Whitehouse
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).