Whamcloud - gitweb
use userland bitops from libcfs.
authorshadow <shadow>
Fri, 21 Dec 2007 10:09:43 +0000 (10:09 +0000)
committershadow <shadow>
Fri, 21 Dec 2007 10:09:43 +0000 (10:09 +0000)
b=14390
i=green
i=deen

lnet/include/libcfs/user-bitops.h
lustre/include/liblustre.h
lustre/mds/mds_lov.c

index 272bcf2..43fc2f1 100644 (file)
@@ -50,7 +50,7 @@ static __inline__ int clear_bit(int nr, long * addr)
         return nr;
 }
 
-static __inline__ int test_bit(int nr, long * addr)
+static __inline__ int test_bit(int nr, const long * addr)
 {
         return ((1UL << (nr & (BITS_PER_LONG - 1))) & ((addr)[nr / BITS_PER_LONG])) != 0;
 }
index 0fbd5bd..2fb2eec 100644 (file)
@@ -65,9 +65,9 @@
 #include <assert.h>
 
 #include <libcfs/list.h>
-#include <libcfs/user-bitops.h>
 #include <lnet/lnet.h>
 #include <libcfs/kp30.h>
+#include <libcfs/user-bitops.h>
 
 /* definitions for liblustre */
 
@@ -189,35 +189,6 @@ typedef int (write_proc_t)(struct file *file, const char *buffer,
  * to allow the compiler to adjust the bit shifting accordingly
  */
 
-/* test if bit nr is set in bitmap addr; returns previous value of bit nr */
-static __inline__ int set_bit(int nr, long * addr)
-{
-        long    mask;
-
-        addr += nr / BITS_PER_LONG;
-        mask = 1UL << (nr & (BITS_PER_LONG - 1));
-        nr = (mask & *addr) != 0;
-        *addr |= mask;
-        return nr;
-}
-
-/* clear bit nr in bitmap addr; returns previous value of bit nr*/
-static __inline__ int clear_bit(int nr, long * addr)
-{
-        long    mask;
-
-        addr += nr / BITS_PER_LONG;
-        mask = 1UL << (nr & (BITS_PER_LONG - 1));
-        nr = (mask & *addr) != 0;
-        *addr &= ~mask;
-        return nr;
-}
-
-static __inline__ int test_bit(int nr, const long * addr)
-{
-        return ((1UL << (nr & (BITS_PER_LONG - 1))) & ((addr)[nr / BITS_PER_LONG])) != 0;
-}
-
 static __inline__ int ext2_set_bit(int nr, void *addr)
 {
         return set_bit(nr, (long*)addr);
index ee98565..3c58c2c 100644 (file)
@@ -171,7 +171,7 @@ void mds_lov_update_objids(struct obd_device *obd, struct lov_mds_md *lmm)
                                " old %llu\n", i, id, data[idx]);
                 if (id > data[idx]) {
                         data[idx] = id;
-                        bitmap_set(mds->mds_lov_page_dirty, page);
+                        cfs_bitmap_set(mds->mds_lov_page_dirty, page);
                 }
         }
         EXIT;
@@ -237,12 +237,12 @@ int mds_lov_write_objids(struct obd_device *obd)
         int i, rc = 0;
         ENTRY;
 
-        if (bitmap_check_empty(mds->mds_lov_page_dirty))
+        if (cfs_bitmap_check_empty(mds->mds_lov_page_dirty))
                 RETURN(0);
 
         mds_lov_dump_objids("write", obd);
 
-        foreach_bit(mds->mds_lov_page_dirty, i) {
+        cfs_foreach_bit(mds->mds_lov_page_dirty, i) {
                 obd_id *data =  mds->mds_lov_page_array[i];
                 unsigned int size = OBJID_PER_PAGE()*sizeof(obd_id);
                 loff_t off = i * size;
@@ -257,7 +257,7 @@ int mds_lov_write_objids(struct obd_device *obd)
                                          size, &off, 0);
                 if (rc < 0)
                         break;
-                bitmap_clear(mds->mds_lov_page_dirty, i);
+                cfs_bitmap_clear(mds->mds_lov_page_dirty, i);
         }
         if (rc >= 0)
                 rc = 0;
@@ -304,7 +304,7 @@ static int mds_lov_get_objid(struct obd_device * obd, struct obd_export *export,
                         mds->mds_lov_objid_lastpage = page;
                         mds->mds_lov_objid_lastidx = off;
                 }
-                bitmap_set(mds->mds_lov_page_dirty, page);
+                cfs_bitmap_set(mds->mds_lov_page_dirty, page);
         }
 out:
         RETURN(rc);