Skip to content

Commit

Permalink
os/bluestore: add cow clone_range via _do_clone_range
Browse files Browse the repository at this point in the history
Signed-off-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Sep 16, 2016
1 parent 78f0176 commit a931dd3
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/os/bluestore/BlueStore.cc
Expand Up @@ -8152,15 +8152,19 @@ int BlueStore::_clone_range(TransContext *txc,
newo->exists = true;
_assign_nid(txc, newo);

r = _do_read(c.get(), oldo, srcoff, length, bl, 0);
if (r < 0)
goto out;
r = _do_write(txc, c, newo, dstoff, bl.length(), bl, 0);
if (r < 0)
goto out;
if (g_conf->bluestore_clone_cow) {
_do_zero(txc, c, newo, dstoff, length);
_do_clone_range(txc, c, oldo, newo, srcoff, length, dstoff);
} else {
r = _do_read(c.get(), oldo, srcoff, length, bl, 0);
if (r < 0)
goto out;
r = _do_write(txc, c, newo, dstoff, bl.length(), bl, 0);
if (r < 0)
goto out;
}

txc->write_onode(newo);

r = 0;

out:
Expand Down

0 comments on commit a931dd3

Please sign in to comment.