static inline
void cfs_bitmap_set(bitmap_t *bitmap, int nbit)
{
- set_bit(nbit, bitmap->data);
+ set_bit(nbit, bitmap->data);
}
static inline
void cfs_bitmap_clear(bitmap_t *bitmap, int nbit)
{
- clear_bit(nbit, bitmap->data);
+ test_and_clear_bit(nbit, bitmap->data);
}
static inline
int cfs_bitmap_check(bitmap_t *bitmap, int nbit)
{
- return test_bit(nbit, bitmap->data);
+ return test_bit(nbit, bitmap->data);
+}
+
+static inline
+int cfs_bitmap_test_and_clear(bitmap_t *bitmap, int nbit)
+{
+ return test_and_clear_bit(nbit, bitmap->data);
}
/* return 0 is bitmap has none set bits */
#define __LIBCFS_USER_BITOPS_H__
/* test if bit nr is set in bitmap addr; returns previous value of bit nr */
-static __inline__ int set_bit(int nr, unsigned long *addr)
+static __inline__ int test_and_set_bit(int nr, unsigned long *addr)
{
unsigned long mask;
return nr;
}
+#define set_bit(n, a) test_and_set_bit(n, a)
+
/* clear bit nr in bitmap addr; returns previous value of bit nr*/
-static __inline__ int clear_bit(int nr, unsigned long *addr)
+static __inline__ int test_and_clear_bit(int nr, unsigned long *addr)
{
unsigned long mask;
return nr;
}
+#define clear_bit(n, a) test_and_clear_bit(n, a)
+
static __inline__ int test_bit(int nr, const unsigned long *addr)
{
return ((1UL << (nr & (BITS_PER_LONG - 1))) &
#define might_sleep_if(c)
#define smp_mb()
-static inline
-int test_and_set_bit(int nr, unsigned long *addr)
-{
- int oldbit;
-
- while (nr >= sizeof(long)) {
- nr -= sizeof(long);
- addr++;
- }
-
- oldbit = (*addr) & (1 << nr);
- *addr |= (1 << nr);
- return oldbit;
-}
-
-static inline
-int test_and_clear_bit(int nr, unsigned long *addr)
-{
- int oldbit;
-
- while (nr >= sizeof(long)) {
- nr -= sizeof(long);
- addr++;
- }
-
- oldbit = (*addr) & (1 << nr);
- *addr &= ~(1 << nr);
- return oldbit;
-}
-
#define libcfs_memory_pressure_get() (0)
#define libcfs_memory_pressure_put() do {} while (0)
#define libcfs_memory_pressure_clr() do {} while (0)
if (spec->no_create != 0) {
*lmm = (struct lov_mds_md *)spec->u.sp_ea.eadata;
*lmm_size = spec->u.sp_ea.eadatalen;
+ LASSERT(*lmm_size == lov_mds_md_size((*lmm)->lmm_stripe_count,
+ (*lmm)->lmm_magic));
RETURN(0);
}
LASSERT(data != NULL);
+ if (!cfs_bitmap_test_and_clear(mds->mds_lov_page_dirty, i))
+ continue;
+
/* check for particaly filled last page */
if (i == mds->mds_lov_objid_lastpage)
size = (mds->mds_lov_objid_lastidx+1) * sizeof(obd_id);
CDEBUG(D_INFO, "write %lld - %u\n", off, size);
rc = fsfilt_write_record(obd, mds->mds_lov_objid_filp, data,
size, &off, 0);
- if (rc < 0)
+ if (rc < 0) {
+ cfs_bitmap_set(mds->mds_lov_page_dirty, i);
break;
- cfs_bitmap_clear(mds->mds_lov_page_dirty, i);
+ }
}
if (rc >= 0)
rc = 0;