Lines Matching defs: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))
905 struct bm_extent *bm_ext;
915 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL;
916 if (bm_ext) {
917 if (bm_ext->lce.lc_number != enr) {
918 bm_ext->rs_left = drbd_bm_e_weight(device, enr);
919 bm_ext->rs_failed = 0;
923 if (bm_ext->lce.refcnt == 1)
925 set_bit(BME_NO_WRITES, &bm_ext->flags);
932 if (!bm_ext) {
939 return bm_ext;
963 struct bm_extent *bm_ext;
969 (bm_ext = _bme_get(device, enr)));
973 if (test_bit(BME_LOCKED, &bm_ext->flags))
982 (sa && test_bit(BME_PRIORITY, &bm_ext->flags)));
984 if (sig || (sa && test_bit(BME_PRIORITY, &bm_ext->flags))) {
986 if (lc_put(device->resync, &bm_ext->lce) == 0) {
987 bm_ext->flags = 0; /* clears BME_NO_WRITES and eventually BME_PRIORITY */
999 set_bit(BME_LOCKED, &bm_ext->flags);
1017 struct bm_extent *bm_ext;
1045 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL;
1046 if (bm_ext) {
1047 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags));
1048 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags));
1049 clear_bit(BME_NO_WRITES, &bm_ext->flags);
1051 if (lc_put(device->resync, &bm_ext->lce) == 0) {
1052 bm_ext->flags = 0;
1062 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL;
1063 if (bm_ext) {
1064 if (test_bit(BME_LOCKED, &bm_ext->flags))
1066 if (!test_and_set_bit(BME_NO_WRITES, &bm_ext->flags)) {
1073 bm_ext->lce.refcnt--;
1074 D_ASSERT(device, bm_ext->lce.refcnt > 0);
1083 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL;
1084 if (!bm_ext) {
1092 if (bm_ext->lce.lc_number != enr) {
1093 bm_ext->rs_left = drbd_bm_e_weight(device, enr);
1094 bm_ext->rs_failed = 0;
1097 D_ASSERT(device, test_bit(BME_LOCKED, &bm_ext->flags) == 0);
1099 set_bit(BME_NO_WRITES, &bm_ext->flags);
1100 D_ASSERT(device, bm_ext->lce.refcnt == 1);
1109 set_bit(BME_LOCKED, &bm_ext->flags);
1116 if (bm_ext) {
1118 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags));
1119 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags));
1120 clear_bit(BME_NO_WRITES, &bm_ext->flags);
1122 if (lc_put(device->resync, &bm_ext->lce) == 0) {
1123 bm_ext->flags = 0;
1138 struct bm_extent *bm_ext;
1143 bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL;
1144 if (!bm_ext) {
1151 if (bm_ext->lce.refcnt == 0) {
1159 if (lc_put(device->resync, &bm_ext->lce) == 0) {
1160 bm_ext->flags = 0; /* clear BME_LOCKED, BME_NO_WRITES and BME_PRIORITY */
1196 struct bm_extent *bm_ext;
1205 bm_ext = lc_entry(e, struct bm_extent, lce);
1206 if (bm_ext->lce.lc_number == LC_FREE)
1208 if (bm_ext->lce.lc_number == device->resync_wenr) {
1212 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags));
1213 D_ASSERT(device, test_bit(BME_NO_WRITES, &bm_ext->flags));
1214 clear_bit(BME_NO_WRITES, &bm_ext->flags);
1216 lc_put(device->resync, &bm_ext->lce);
1218 if (bm_ext->lce.refcnt != 0) {
1220 "refcnt=%d\n", bm_ext->lce.refcnt);
1225 D_ASSERT(device, !test_bit(BME_LOCKED, &bm_ext->flags));
1226 D_ASSERT(device, !test_bit(BME_NO_WRITES, &bm_ext->flags));
1227 lc_del(device->resync, &bm_ext->lce);