orangefs_bufmap_..._query(): don't bother with refcounts
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 13 Feb 2016 16:16:37 +0000 (11:16 -0500)
committerMike Marshall <hubcap@omnibond.com>
Fri, 19 Feb 2016 18:45:54 +0000 (13:45 -0500)
... just hold the spinlock while fetching the field in question.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
fs/orangefs/orangefs-bufmap.c

index 1819dee584334800ed69490e40016b5698a41eba..cd484665bf7250a83362e2ede6a3a68e9a7472bd 100644 (file)
@@ -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;
 }