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