Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/object/srv_obj_migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1966,6 +1966,7 @@ migrate_one_ult(void *arg)
struct migrate_one *mrone = arg;
struct migrate_pool_tls *tls;
daos_size_t data_size;
daos_size_t degraded_size = 0;
int rc = 0;

while (daos_fail_check(DAOS_REBUILD_TGT_REBUILD_HANG))
Expand All @@ -1978,6 +1979,21 @@ migrate_one_ult(void *arg)
}

data_size = daos_iods_len(mrone->mo_iods, mrone->mo_iod_num);
if (daos_oclass_is_ec(&mrone->mo_oca)) {
/* NB: this is a workaround for EC object:
* The fetch buffer is taken from a pre-registered (R)DMA buffer;
* however, a degraded EC read will allocate and register an extra
* buffer to recover data.
*
* Currently, the resource manager cannot control this extra allocation,
* which can lead to increased memory consumption.
*
* While this workaround does not prevent dynamic buffer allocation and
* registration, it does provide relatively precise control over the
* resources consumed by degraded EC reads.
*/
degraded_size = data_size * MIN(8, obj_ec_data_tgt_nr(&mrone->mo_oca));
}
data_size += daos_iods_len(mrone->mo_iods_from_parity,
mrone->mo_iods_num_from_parity);

Expand All @@ -1986,13 +2002,13 @@ migrate_one_ult(void *arg)

D_ASSERT(data_size != (daos_size_t)-1);

rc = migrate_res_hold(tls, MIGR_DATA, data_size, NULL);
rc = migrate_res_hold(tls, MIGR_DATA, data_size + degraded_size, NULL);
if (rc)
D_GOTO(out, rc);

rc = migrate_dkey(tls, mrone, data_size);

migrate_res_release(tls, MIGR_DATA, data_size);
migrate_res_release(tls, MIGR_DATA, data_size + degraded_size);

D_DEBUG(DB_REBUILD, DF_UOID" layout %u migrate dkey "DF_KEY" inflight_size "DF_U64": "
DF_RC"\n", DP_UOID(mrone->mo_oid), mrone->mo_oid.id_layout_ver,
Expand Down
Loading