Lines Matching refs:bm_ext

223 		struct bm_extent  *bm_ext = lc_entry(tmp, struct bm_extent, lce);  in find_active_resync_extent()  local
224 if (test_bit(BME_NO_WRITES, &bm_ext->flags)) in find_active_resync_extent()
225 return bm_ext; in find_active_resync_extent()
233 struct bm_extent *bm_ext; in _al_get() local
237 bm_ext = find_active_resync_extent(device, enr); in _al_get()
238 if (bm_ext) { in _al_get()
239 wake = !test_and_set_bit(BME_PRIORITY, &bm_ext->flags); in _al_get()
535 struct bm_extent *bm_ext = lc_entry(tmp, struct bm_extent, lce); in drbd_al_begin_io_nonblock() local
536 if (test_bit(BME_NO_WRITES, &bm_ext->flags)) { in drbd_al_begin_io_nonblock()
537 if (!test_and_set_bit(BME_PRIORITY, &bm_ext->flags)) in drbd_al_begin_io_nonblock()
917 struct bm_extent *bm_ext; in _bme_get() local
927 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in _bme_get()
928 if (bm_ext) { in _bme_get()
929 if (bm_ext->lce.lc_number != enr) { in _bme_get()
930 bm_ext->rs_left = drbd_bm_e_weight(device, enr); in _bme_get()
931 bm_ext->rs_failed = 0; in _bme_get()
935 if (bm_ext->lce.refcnt == 1) in _bme_get()
937 set_bit(BME_NO_WRITES, &bm_ext->flags); in _bme_get()
944 if (!bm_ext) { in _bme_get()
951 return bm_ext; in _bme_get()
975 struct bm_extent *bm_ext; in drbd_rs_begin_io() local
981 (bm_ext = _bme_get(device, enr))); in drbd_rs_begin_io()
985 if (test_bit(BME_LOCKED, &bm_ext->flags)) in drbd_rs_begin_io()
994 (sa && test_bit(BME_PRIORITY, &bm_ext->flags))); in drbd_rs_begin_io()
996 if (sig || (sa && test_bit(BME_PRIORITY, &bm_ext->flags))) { in drbd_rs_begin_io()
998 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_rs_begin_io()
999 bm_ext->flags = 0; /* clears BME_NO_WRITES and eventually BME_PRIORITY */ in drbd_rs_begin_io()
1011 set_bit(BME_LOCKED, &bm_ext->flags); in drbd_rs_begin_io()
1029 struct bm_extent *bm_ext; in drbd_try_rs_begin_io() local
1057 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_try_rs_begin_io()
1058 if (bm_ext) { in drbd_try_rs_begin_io()
1059 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_try_rs_begin_io()
1060 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_try_rs_begin_io()
1061 clear_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_try_rs_begin_io()
1063 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_try_rs_begin_io()
1064 bm_ext->flags = 0; in drbd_try_rs_begin_io()
1074 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_try_rs_begin_io()
1075 if (bm_ext) { in drbd_try_rs_begin_io()
1076 if (test_bit(BME_LOCKED, &bm_ext->flags)) in drbd_try_rs_begin_io()
1078 if (!test_and_set_bit(BME_NO_WRITES, &bm_ext->flags)) { in drbd_try_rs_begin_io()
1085 bm_ext->lce.refcnt--; in drbd_try_rs_begin_io()
1086 D_ASSERT(device, bm_ext->lce.refcnt > 0); in drbd_try_rs_begin_io()
1095 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_try_rs_begin_io()
1096 if (!bm_ext) { in drbd_try_rs_begin_io()
1104 if (bm_ext->lce.lc_number != enr) { in drbd_try_rs_begin_io()
1105 bm_ext->rs_left = drbd_bm_e_weight(device, enr); in drbd_try_rs_begin_io()
1106 bm_ext->rs_failed = 0; in drbd_try_rs_begin_io()
1109 D_ASSERT(device, test_bit(BME_LOCKED, &bm_ext->flags) == 0); in drbd_try_rs_begin_io()
1111 set_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_try_rs_begin_io()
1112 D_ASSERT(device, bm_ext->lce.refcnt == 1); in drbd_try_rs_begin_io()
1121 set_bit(BME_LOCKED, &bm_ext->flags); in drbd_try_rs_begin_io()
1128 if (bm_ext) { in drbd_try_rs_begin_io()
1130 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_try_rs_begin_io()
1131 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_try_rs_begin_io()
1132 clear_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_try_rs_begin_io()
1134 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_try_rs_begin_io()
1135 bm_ext->flags = 0; in drbd_try_rs_begin_io()
1150 struct bm_extent *bm_ext; in drbd_rs_complete_io() local
1155 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_rs_complete_io()
1156 if (!bm_ext) { in drbd_rs_complete_io()
1163 if (bm_ext->lce.refcnt == 0) { in drbd_rs_complete_io()
1171 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_rs_complete_io()
1172 bm_ext->flags = 0; /* clear BME_LOCKED, BME_NO_WRITES and BME_PRIORITY */ in drbd_rs_complete_io()
1208 struct bm_extent *bm_ext; in drbd_rs_del_all() local
1217 bm_ext = lc_entry(e, struct bm_extent, lce); in drbd_rs_del_all()
1218 if (bm_ext->lce.lc_number == LC_FREE) in drbd_rs_del_all()
1220 if (bm_ext->lce.lc_number == device->resync_wenr) { in drbd_rs_del_all()
1224 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_rs_del_all()
1225 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_rs_del_all()
1226 clear_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_rs_del_all()
1228 lc_put(device->resync, &bm_ext->lce); in drbd_rs_del_all()
1230 if (bm_ext->lce.refcnt != 0) { in drbd_rs_del_all()
1232 "refcnt=%d\n", bm_ext->lce.refcnt); in drbd_rs_del_all()
1237 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_rs_del_all()
1238 D_ASSERT(device, !test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_rs_del_all()
1239 lc_del(device->resync, &bm_ext->lce); in drbd_rs_del_all()