From 2c12b5d371a5338e0e9e88bd2716430fe6e47c81 Mon Sep 17 00:00:00 2001 From: shadow Date: Fri, 21 Dec 2007 09:32:48 +0000 Subject: [PATCH] cleanup in userland bitops code. b=14390 i=green i=deen --- lustre/include/liblustre.h | 31 +------------------------------ lustre/mds/mds_lov.c | 10 +++++----- 2 files changed, 6 insertions(+), 35 deletions(-) diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h index 4e80252..c368a7b 100644 --- a/lustre/include/liblustre.h +++ b/lustre/include/liblustre.h @@ -64,9 +64,9 @@ #include #include -#include #include #include +#include /* 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); diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index 33a19f0..4cf876a 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -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]); -- 1.8.3.1