Lines Matching refs:bm_ext
211 struct bm_extent *bm_ext = lc_entry(tmp, struct bm_extent, lce); in find_active_resync_extent() local
212 if (test_bit(BME_NO_WRITES, &bm_ext->flags)) in find_active_resync_extent()
213 return bm_ext; in find_active_resync_extent()
221 struct bm_extent *bm_ext; in _al_get() local
225 bm_ext = find_active_resync_extent(device, enr); in _al_get()
226 if (bm_ext) { in _al_get()
227 wake = !test_and_set_bit(BME_PRIORITY, &bm_ext->flags); in _al_get()
523 struct bm_extent *bm_ext = lc_entry(tmp, struct bm_extent, lce); in drbd_al_begin_io_nonblock() local
524 if (test_bit(BME_NO_WRITES, &bm_ext->flags)) { in drbd_al_begin_io_nonblock()
525 if (!test_and_set_bit(BME_PRIORITY, &bm_ext->flags)) in drbd_al_begin_io_nonblock()
905 struct bm_extent *bm_ext; in _bme_get() local
915 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in _bme_get()
916 if (bm_ext) { in _bme_get()
917 if (bm_ext->lce.lc_number != enr) { in _bme_get()
918 bm_ext->rs_left = drbd_bm_e_weight(device, enr); in _bme_get()
919 bm_ext->rs_failed = 0; in _bme_get()
923 if (bm_ext->lce.refcnt == 1) in _bme_get()
925 set_bit(BME_NO_WRITES, &bm_ext->flags); in _bme_get()
932 if (!bm_ext) { in _bme_get()
939 return bm_ext; in _bme_get()
963 struct bm_extent *bm_ext; in drbd_rs_begin_io() local
969 (bm_ext = _bme_get(device, enr))); in drbd_rs_begin_io()
973 if (test_bit(BME_LOCKED, &bm_ext->flags)) in drbd_rs_begin_io()
982 (sa && test_bit(BME_PRIORITY, &bm_ext->flags))); in drbd_rs_begin_io()
984 if (sig || (sa && test_bit(BME_PRIORITY, &bm_ext->flags))) { in drbd_rs_begin_io()
986 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_rs_begin_io()
987 bm_ext->flags = 0; /* clears BME_NO_WRITES and eventually BME_PRIORITY */ in drbd_rs_begin_io()
999 set_bit(BME_LOCKED, &bm_ext->flags); in drbd_rs_begin_io()
1017 struct bm_extent *bm_ext; in drbd_try_rs_begin_io() local
1045 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_try_rs_begin_io()
1046 if (bm_ext) { in drbd_try_rs_begin_io()
1047 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_try_rs_begin_io()
1048 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_try_rs_begin_io()
1049 clear_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_try_rs_begin_io()
1051 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_try_rs_begin_io()
1052 bm_ext->flags = 0; in drbd_try_rs_begin_io()
1062 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_try_rs_begin_io()
1063 if (bm_ext) { in drbd_try_rs_begin_io()
1064 if (test_bit(BME_LOCKED, &bm_ext->flags)) in drbd_try_rs_begin_io()
1066 if (!test_and_set_bit(BME_NO_WRITES, &bm_ext->flags)) { in drbd_try_rs_begin_io()
1073 bm_ext->lce.refcnt--; in drbd_try_rs_begin_io()
1074 D_ASSERT(device, bm_ext->lce.refcnt > 0); in drbd_try_rs_begin_io()
1083 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_try_rs_begin_io()
1084 if (!bm_ext) { in drbd_try_rs_begin_io()
1092 if (bm_ext->lce.lc_number != enr) { in drbd_try_rs_begin_io()
1093 bm_ext->rs_left = drbd_bm_e_weight(device, enr); in drbd_try_rs_begin_io()
1094 bm_ext->rs_failed = 0; in drbd_try_rs_begin_io()
1097 D_ASSERT(device, test_bit(BME_LOCKED, &bm_ext->flags) == 0); in drbd_try_rs_begin_io()
1099 set_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_try_rs_begin_io()
1100 D_ASSERT(device, bm_ext->lce.refcnt == 1); in drbd_try_rs_begin_io()
1109 set_bit(BME_LOCKED, &bm_ext->flags); in drbd_try_rs_begin_io()
1116 if (bm_ext) { in drbd_try_rs_begin_io()
1118 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_try_rs_begin_io()
1119 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_try_rs_begin_io()
1120 clear_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_try_rs_begin_io()
1122 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_try_rs_begin_io()
1123 bm_ext->flags = 0; in drbd_try_rs_begin_io()
1138 struct bm_extent *bm_ext; in drbd_rs_complete_io() local
1143 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_rs_complete_io()
1144 if (!bm_ext) { in drbd_rs_complete_io()
1151 if (bm_ext->lce.refcnt == 0) { in drbd_rs_complete_io()
1159 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_rs_complete_io()
1160 bm_ext->flags = 0; /* clear BME_LOCKED, BME_NO_WRITES and BME_PRIORITY */ in drbd_rs_complete_io()
1196 struct bm_extent *bm_ext; in drbd_rs_del_all() local
1205 bm_ext = lc_entry(e, struct bm_extent, lce); in drbd_rs_del_all()
1206 if (bm_ext->lce.lc_number == LC_FREE) in drbd_rs_del_all()
1208 if (bm_ext->lce.lc_number == device->resync_wenr) { in drbd_rs_del_all()
1212 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_rs_del_all()
1213 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_rs_del_all()
1214 clear_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_rs_del_all()
1216 lc_put(device->resync, &bm_ext->lce); in drbd_rs_del_all()
1218 if (bm_ext->lce.refcnt != 0) { in drbd_rs_del_all()
1220 "refcnt=%d\n", bm_ext->lce.refcnt); in drbd_rs_del_all()
1225 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_rs_del_all()
1226 D_ASSERT(device, !test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_rs_del_all()
1227 lc_del(device->resync, &bm_ext->lce); in drbd_rs_del_all()