diff options
author | Brian Behlendorf <behlendorf1@llnl.gov> | 2018-10-08 21:58:21 +0000 |
---|---|---|
committer | Brian Behlendorf <behlendorf1@llnl.gov> | 2018-10-09 17:05:48 +0000 |
commit | d7e4b30a672c1d7eb77dbbe2cdcf14cac102839a (patch) | |
tree | e9d61baf611a5479fd047b7170b67ea57dd2abf7 /module | |
parent | 4cbde2ecbf7c6478bac106fadd6a23f53d538262 (diff) | |
download | src-d7e4b30a672c1d7eb77dbbe2cdcf14cac102839a.tar.gz src-d7e4b30a672c1d7eb77dbbe2cdcf14cac102839a.zip |
Diffstat (limited to 'module')
-rw-r--r-- | module/zfs/arc.c | 8 | ||||
-rw-r--r-- | module/zfs/refcount.c | 15 |
2 files changed, 16 insertions, 7 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c index ae912ee6eb11..e5d88fe5d7ef 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -3081,8 +3081,8 @@ arc_share_buf(arc_buf_hdr_t *hdr, arc_buf_t *buf) * refcount ownership to the hdr since it always owns * the refcount whenever an arc_buf_t is shared. */ - zfs_refcount_transfer_ownership(&hdr->b_l1hdr.b_state->arcs_size, - buf, hdr); + zfs_refcount_transfer_ownership_many(&hdr->b_l1hdr.b_state->arcs_size, + arc_hdr_size(hdr), buf, hdr); hdr->b_l1hdr.b_pabd = abd_get_from_buf(buf->b_data, arc_buf_size(buf)); abd_take_ownership_of_buf(hdr->b_l1hdr.b_pabd, HDR_ISTYPE_METADATA(hdr)); @@ -3110,8 +3110,8 @@ arc_unshare_buf(arc_buf_hdr_t *hdr, arc_buf_t *buf) * We are no longer sharing this buffer so we need * to transfer its ownership to the rightful owner. */ - zfs_refcount_transfer_ownership(&hdr->b_l1hdr.b_state->arcs_size, - hdr, buf); + zfs_refcount_transfer_ownership_many(&hdr->b_l1hdr.b_state->arcs_size, + arc_hdr_size(hdr), hdr, buf); arc_hdr_clear_flags(hdr, ARC_FLAG_SHARED_DATA); abd_release_ownership_of_buf(hdr->b_l1hdr.b_pabd); abd_put(hdr->b_l1hdr.b_pabd); diff --git a/module/zfs/refcount.c b/module/zfs/refcount.c index 0a93aafb1358..bcaa6d387539 100644 --- a/module/zfs/refcount.c +++ b/module/zfs/refcount.c @@ -234,8 +234,8 @@ zfs_refcount_transfer(zfs_refcount_t *dst, zfs_refcount_t *src) } void -zfs_refcount_transfer_ownership(zfs_refcount_t *rc, void *current_holder, - void *new_holder) +zfs_refcount_transfer_ownership_many(zfs_refcount_t *rc, uint64_t number, + void *current_holder, void *new_holder) { reference_t *ref; boolean_t found = B_FALSE; @@ -248,7 +248,8 @@ zfs_refcount_transfer_ownership(zfs_refcount_t *rc, void *current_holder, for (ref = list_head(&rc->rc_list); ref; ref = list_next(&rc->rc_list, ref)) { - if (ref->ref_holder == current_holder) { + if (ref->ref_holder == current_holder && + ref->ref_number == number) { ref->ref_holder = new_holder; found = B_TRUE; break; @@ -258,6 +259,14 @@ zfs_refcount_transfer_ownership(zfs_refcount_t *rc, void *current_holder, mutex_exit(&rc->rc_mtx); } +void +zfs_refcount_transfer_ownership(zfs_refcount_t *rc, void *current_holder, + void *new_holder) +{ + return (zfs_refcount_transfer_ownership_many(rc, 1, current_holder, + new_holder)); +} + /* * If tracking is enabled, return true if a reference exists that matches * the "holder" tag. If tracking is disabled, then return true if a reference |