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