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()
965 struct bm_extent *bm_ext; in drbd_rs_begin_io() local
971 (bm_ext = _bme_get(device, enr))); in drbd_rs_begin_io()
975 if (test_bit(BME_LOCKED, &bm_ext->flags)) in drbd_rs_begin_io()
984 (sa && test_bit(BME_PRIORITY, &bm_ext->flags))); in drbd_rs_begin_io()
986 if (sig || (sa && test_bit(BME_PRIORITY, &bm_ext->flags))) { in drbd_rs_begin_io()
988 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_rs_begin_io()
989 bm_ext->flags = 0; /* clears BME_NO_WRITES and eventually BME_PRIORITY */ in drbd_rs_begin_io()
1001 set_bit(BME_LOCKED, &bm_ext->flags); in drbd_rs_begin_io()
1020 struct bm_extent *bm_ext; in drbd_try_rs_begin_io() local
1048 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_try_rs_begin_io()
1049 if (bm_ext) { in drbd_try_rs_begin_io()
1050 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_try_rs_begin_io()
1051 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_try_rs_begin_io()
1052 clear_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_try_rs_begin_io()
1054 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_try_rs_begin_io()
1055 bm_ext->flags = 0; in drbd_try_rs_begin_io()
1065 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_try_rs_begin_io()
1066 if (bm_ext) { in drbd_try_rs_begin_io()
1067 if (test_bit(BME_LOCKED, &bm_ext->flags)) in drbd_try_rs_begin_io()
1069 if (!test_and_set_bit(BME_NO_WRITES, &bm_ext->flags)) { in drbd_try_rs_begin_io()
1076 bm_ext->lce.refcnt--; in drbd_try_rs_begin_io()
1077 D_ASSERT(device, bm_ext->lce.refcnt > 0); in drbd_try_rs_begin_io()
1086 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_try_rs_begin_io()
1087 if (!bm_ext) { in drbd_try_rs_begin_io()
1095 if (bm_ext->lce.lc_number != enr) { in drbd_try_rs_begin_io()
1096 bm_ext->rs_left = drbd_bm_e_weight(device, enr); in drbd_try_rs_begin_io()
1097 bm_ext->rs_failed = 0; in drbd_try_rs_begin_io()
1100 D_ASSERT(device, test_bit(BME_LOCKED, &bm_ext->flags) == 0); in drbd_try_rs_begin_io()
1102 set_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_try_rs_begin_io()
1103 D_ASSERT(device, bm_ext->lce.refcnt == 1); in drbd_try_rs_begin_io()
1112 set_bit(BME_LOCKED, &bm_ext->flags); in drbd_try_rs_begin_io()
1119 if (bm_ext) { in drbd_try_rs_begin_io()
1121 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_try_rs_begin_io()
1122 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_try_rs_begin_io()
1123 clear_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_try_rs_begin_io()
1125 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_try_rs_begin_io()
1126 bm_ext->flags = 0; in drbd_try_rs_begin_io()
1141 struct bm_extent *bm_ext; in drbd_rs_complete_io() local
1146 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_rs_complete_io()
1147 if (!bm_ext) { in drbd_rs_complete_io()
1154 if (bm_ext->lce.refcnt == 0) { in drbd_rs_complete_io()
1162 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_rs_complete_io()
1163 bm_ext->flags = 0; /* clear BME_LOCKED, BME_NO_WRITES and BME_PRIORITY */ in drbd_rs_complete_io()
1199 struct bm_extent *bm_ext; in drbd_rs_del_all() local
1208 bm_ext = lc_entry(e, struct bm_extent, lce); in drbd_rs_del_all()
1209 if (bm_ext->lce.lc_number == LC_FREE) in drbd_rs_del_all()
1211 if (bm_ext->lce.lc_number == device->resync_wenr) { in drbd_rs_del_all()
1215 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_rs_del_all()
1216 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_rs_del_all()
1217 clear_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_rs_del_all()
1219 lc_put(device->resync, &bm_ext->lce); in drbd_rs_del_all()
1221 if (bm_ext->lce.refcnt != 0) { in drbd_rs_del_all()
1223 "refcnt=%d\n", bm_ext->lce.refcnt); in drbd_rs_del_all()
1228 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_rs_del_all()
1229 D_ASSERT(device, !test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_rs_del_all()
1230 lc_del(device->resync, &bm_ext->lce); in drbd_rs_del_all()