Whamcloud - gitweb
cleanup in userland bitops code.
authorshadow <shadow>
Fri, 21 Dec 2007 09:32:48 +0000 (09:32 +0000)
committershadow <shadow>
Fri, 21 Dec 2007 09:32:48 +0000 (09:32 +0000)
b=14390
i=green
i=deen

lustre/include/liblustre.h
lustre/mds/mds_lov.c

index 4e80252..c368a7b 100644 (file)
@@ -64,9 +64,9 @@
 #include <fcntl.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 */
 
@@ -192,35 +192,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, 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 33a19f0..4cf876a 100644 (file)
@@ -172,7 +172,7 @@ void mds_lov_update_objids(struct obd_device *obd, struct lov_mds_md *lmm)
                        " - new "LPU64" old "LPU64"\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;
@@ -238,12 +238,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;
@@ -258,7 +258,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;
@@ -305,7 +305,7 @@ static int mds_lov_get_objid(struct obd_device * obd,
                         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);
         }
         CDEBUG(D_INFO, "idx %d - %p - %d/%d - "LPU64"\n",
                idx, data, page, off, data[off]);