Lines Matching refs:bm_ext

222 		struct bm_extent  *bm_ext = lc_entry(tmp, struct bm_extent, lce);  in find_active_resync_extent()  local
223 if (test_bit(BME_NO_WRITES, &bm_ext->flags)) in find_active_resync_extent()
224 return bm_ext; in find_active_resync_extent()
232 struct bm_extent *bm_ext; in _al_get() local
236 bm_ext = find_active_resync_extent(device, enr); in _al_get()
237 if (bm_ext) { in _al_get()
238 wake = !test_and_set_bit(BME_PRIORITY, &bm_ext->flags); in _al_get()
377 struct bm_extent *bm_ext = lc_entry(tmp, struct bm_extent, lce); in drbd_al_begin_io_nonblock() local
378 if (test_bit(BME_NO_WRITES, &bm_ext->flags)) { in drbd_al_begin_io_nonblock()
379 if (!test_and_set_bit(BME_PRIORITY, &bm_ext->flags)) in drbd_al_begin_io_nonblock()
888 struct bm_extent *bm_ext; in _bme_get() local
898 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in _bme_get()
899 if (bm_ext) { in _bme_get()
900 if (bm_ext->lce.lc_number != enr) { in _bme_get()
901 bm_ext->rs_left = drbd_bm_e_weight(device, enr); in _bme_get()
902 bm_ext->rs_failed = 0; in _bme_get()
906 if (bm_ext->lce.refcnt == 1) in _bme_get()
908 set_bit(BME_NO_WRITES, &bm_ext->flags); in _bme_get()
915 if (!bm_ext) { in _bme_get()
922 return bm_ext; in _bme_get()
946 struct bm_extent *bm_ext; in drbd_rs_begin_io() local
952 (bm_ext = _bme_get(device, enr))); in drbd_rs_begin_io()
956 if (test_bit(BME_LOCKED, &bm_ext->flags)) in drbd_rs_begin_io()
965 (sa && test_bit(BME_PRIORITY, &bm_ext->flags))); in drbd_rs_begin_io()
967 if (sig || (sa && test_bit(BME_PRIORITY, &bm_ext->flags))) { in drbd_rs_begin_io()
969 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_rs_begin_io()
970 bm_ext->flags = 0; /* clears BME_NO_WRITES and eventually BME_PRIORITY */ in drbd_rs_begin_io()
982 set_bit(BME_LOCKED, &bm_ext->flags); in drbd_rs_begin_io()
1000 struct bm_extent *bm_ext; in drbd_try_rs_begin_io() local
1028 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_try_rs_begin_io()
1029 if (bm_ext) { in drbd_try_rs_begin_io()
1030 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_try_rs_begin_io()
1031 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_try_rs_begin_io()
1032 clear_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_try_rs_begin_io()
1034 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_try_rs_begin_io()
1035 bm_ext->flags = 0; in drbd_try_rs_begin_io()
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 if (test_bit(BME_LOCKED, &bm_ext->flags)) in drbd_try_rs_begin_io()
1049 if (!test_and_set_bit(BME_NO_WRITES, &bm_ext->flags)) { in drbd_try_rs_begin_io()
1056 bm_ext->lce.refcnt--; in drbd_try_rs_begin_io()
1057 D_ASSERT(device, bm_ext->lce.refcnt > 0); in drbd_try_rs_begin_io()
1066 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_try_rs_begin_io()
1067 if (!bm_ext) { in drbd_try_rs_begin_io()
1075 if (bm_ext->lce.lc_number != enr) { in drbd_try_rs_begin_io()
1076 bm_ext->rs_left = drbd_bm_e_weight(device, enr); in drbd_try_rs_begin_io()
1077 bm_ext->rs_failed = 0; in drbd_try_rs_begin_io()
1080 D_ASSERT(device, test_bit(BME_LOCKED, &bm_ext->flags) == 0); in drbd_try_rs_begin_io()
1082 set_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_try_rs_begin_io()
1083 D_ASSERT(device, bm_ext->lce.refcnt == 1); in drbd_try_rs_begin_io()
1092 set_bit(BME_LOCKED, &bm_ext->flags); in drbd_try_rs_begin_io()
1099 if (bm_ext) { in drbd_try_rs_begin_io()
1101 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_try_rs_begin_io()
1102 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_try_rs_begin_io()
1103 clear_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_try_rs_begin_io()
1105 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_try_rs_begin_io()
1106 bm_ext->flags = 0; in drbd_try_rs_begin_io()
1121 struct bm_extent *bm_ext; in drbd_rs_complete_io() local
1126 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; in drbd_rs_complete_io()
1127 if (!bm_ext) { in drbd_rs_complete_io()
1134 if (bm_ext->lce.refcnt == 0) { in drbd_rs_complete_io()
1142 if (lc_put(device->resync, &bm_ext->lce) == 0) { in drbd_rs_complete_io()
1143 bm_ext->flags = 0; /* clear BME_LOCKED, BME_NO_WRITES and BME_PRIORITY */ in drbd_rs_complete_io()
1179 struct bm_extent *bm_ext; in drbd_rs_del_all() local
1188 bm_ext = lc_entry(e, struct bm_extent, lce); in drbd_rs_del_all()
1189 if (bm_ext->lce.lc_number == LC_FREE) in drbd_rs_del_all()
1191 if (bm_ext->lce.lc_number == device->resync_wenr) { in drbd_rs_del_all()
1195 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_rs_del_all()
1196 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_rs_del_all()
1197 clear_bit(BME_NO_WRITES, &bm_ext->flags); in drbd_rs_del_all()
1199 lc_put(device->resync, &bm_ext->lce); in drbd_rs_del_all()
1201 if (bm_ext->lce.refcnt != 0) { in drbd_rs_del_all()
1203 "refcnt=%d\n", bm_ext->lce.refcnt); in drbd_rs_del_all()
1208 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags)); in drbd_rs_del_all()
1209 D_ASSERT(device, !test_bit(BME_NO_WRITES, &bm_ext->flags)); in drbd_rs_del_all()
1210 lc_del(device->resync, &bm_ext->lce); in drbd_rs_del_all()