From: Al Viro Date: Sat, 13 Feb 2016 16:16:37 +0000 (-0500) Subject: orangefs_bufmap_..._query(): don't bother with refcounts X-Git-Tag: v5.15~13906^2~53 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=178041848a6e7072cc6ebc1c6c7763e33f564722;p=platform%2Fkernel%2Flinux-starfive.git orangefs_bufmap_..._query(): don't bother with refcounts ... just hold the spinlock while fetching the field in question. Signed-off-by: Al Viro Signed-off-by: Mike Marshall --- diff --git a/fs/orangefs/orangefs-bufmap.c b/fs/orangefs/orangefs-bufmap.c index 1819dee..cd484665 100644 --- a/fs/orangefs/orangefs-bufmap.c +++ b/fs/orangefs/orangefs-bufmap.c @@ -91,11 +91,11 @@ int orangefs_bufmap_size_query(void) { struct orangefs_bufmap *bufmap; int size = 0; - bufmap = orangefs_bufmap_ref(); - if (bufmap) { + spin_lock(&orangefs_bufmap_lock); + bufmap = __orangefs_bufmap; + if (bufmap) size = bufmap->desc_size; - orangefs_bufmap_unref(bufmap); - } + spin_unlock(&orangefs_bufmap_lock); return size; } @@ -103,11 +103,11 @@ int orangefs_bufmap_shift_query(void) { struct orangefs_bufmap *bufmap; int shift = 0; - bufmap = orangefs_bufmap_ref(); - if (bufmap) { + spin_lock(&orangefs_bufmap_lock); + bufmap = __orangefs_bufmap; + if (bufmap) shift = bufmap->desc_shift; - orangefs_bufmap_unref(bufmap); - } + spin_unlock(&orangefs_bufmap_lock); return shift; }