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()
907 struct bm_extent *bm_ext; in _bme_get() local
917 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in _bme_get()
918 if (bm_ext) { in _bme_get()
919 if (bm_ext->lce.lc_number != enr) { in _bme_get()
920 bm_ext->rs_left = drbd_bm_e_weight(device, enr); in _bme_get()
921 bm_ext->rs_failed = 0; in _bme_get()
925 if (bm_ext->lce.refcnt == 1) in _bme_get()
927 set_bit(BME_NO_WRITES, &bm_ext->flags); in _bme_get()
934 if (!bm_ext) { in _bme_get()
941 return bm_ext; in _bme_get()
967 struct bm_extent *bm_ext; in drbd_rs_begin_io() local
973 (bm_ext = _bme_get(device, enr))); in drbd_rs_begin_io()
977 if (test_bit(BME_LOCKED, &bm_ext->flags)) in drbd_rs_begin_io()
986 (sa && test_bit(BME_PRIORITY, &bm_ext->flags))); in drbd_rs_begin_io()
988 if (sig || (sa && test_bit(BME_PRIORITY, &bm_ext->flags))) { in drbd_rs_begin_io()
990 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_rs_begin_io()
991 bm_ext->flags = 0; /* clears BME_NO_WRITES and eventually BME_PRIORITY */ in drbd_rs_begin_io()
1003 set_bit(BME_LOCKED, &bm_ext->flags); in drbd_rs_begin_io()
1024 struct bm_extent *bm_ext; in drbd_try_rs_begin_io() local
1052 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_try_rs_begin_io()
1053 if (bm_ext) { in drbd_try_rs_begin_io()
1054 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_try_rs_begin_io()
1055 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_try_rs_begin_io()
1056 clear_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_try_rs_begin_io()
1058 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_try_rs_begin_io()
1059 bm_ext->flags = 0; in drbd_try_rs_begin_io()
1069 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_try_rs_begin_io()
1070 if (bm_ext) { in drbd_try_rs_begin_io()
1071 if (test_bit(BME_LOCKED, &bm_ext->flags)) in drbd_try_rs_begin_io()
1073 if (!test_and_set_bit(BME_NO_WRITES, &bm_ext->flags)) { in drbd_try_rs_begin_io()
1080 bm_ext->lce.refcnt--; in drbd_try_rs_begin_io()
1081 D_ASSERT(device, bm_ext->lce.refcnt > 0); in drbd_try_rs_begin_io()
1090 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_try_rs_begin_io()
1091 if (!bm_ext) { in drbd_try_rs_begin_io()
1099 if (bm_ext->lce.lc_number != enr) { in drbd_try_rs_begin_io()
1100 bm_ext->rs_left = drbd_bm_e_weight(device, enr); in drbd_try_rs_begin_io()
1101 bm_ext->rs_failed = 0; in drbd_try_rs_begin_io()
1104 D_ASSERT(device, test_bit(BME_LOCKED, &bm_ext->flags) == 0); in drbd_try_rs_begin_io()
1106 set_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_try_rs_begin_io()
1107 D_ASSERT(device, bm_ext->lce.refcnt == 1); in drbd_try_rs_begin_io()
1116 set_bit(BME_LOCKED, &bm_ext->flags); in drbd_try_rs_begin_io()
1123 if (bm_ext) { in drbd_try_rs_begin_io()
1125 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_try_rs_begin_io()
1126 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_try_rs_begin_io()
1127 clear_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_try_rs_begin_io()
1129 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_try_rs_begin_io()
1130 bm_ext->flags = 0; in drbd_try_rs_begin_io()
1145 struct bm_extent *bm_ext; in drbd_rs_complete_io() local
1150 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_rs_complete_io()
1151 if (!bm_ext) { in drbd_rs_complete_io()
1158 if (bm_ext->lce.refcnt == 0) { in drbd_rs_complete_io()
1166 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_rs_complete_io()
1167 bm_ext->flags = 0; /* clear BME_LOCKED, BME_NO_WRITES and BME_PRIORITY */ in drbd_rs_complete_io()
1203 struct bm_extent *bm_ext; in drbd_rs_del_all() local
1212 bm_ext = lc_entry(e, struct bm_extent, lce); in drbd_rs_del_all()
1213 if (bm_ext->lce.lc_number == LC_FREE) in drbd_rs_del_all()
1215 if (bm_ext->lce.lc_number == device->resync_wenr) { in drbd_rs_del_all()
1219 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_rs_del_all()
1220 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_rs_del_all()
1221 clear_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_rs_del_all()
1223 lc_put(device->resync, &bm_ext->lce); in drbd_rs_del_all()
1225 if (bm_ext->lce.refcnt != 0) { in drbd_rs_del_all()
1227 "refcnt=%d\n", bm_ext->lce.refcnt); in drbd_rs_del_all()
1232 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_rs_del_all()
1233 D_ASSERT(device, !test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_rs_del_all()
1234 lc_del(device->resync, &bm_ext->lce); in drbd_rs_del_all()