Skip to content

Commit

Permalink
filestore: use IOC_CLONERANGE intead of IOC_CLONE ioctl
Browse files Browse the repository at this point in the history
This is functionally equivalent, except that valgrind doesn't complain
about a bad pointer passed to an ioctl.

Signed-off-by: Sage Weil <[email protected]>
Reviewed-by: Samuel Just <[email protected]>
  • Loading branch information
liewegas committed Feb 23, 2012
1 parent 64ca584 commit 86a54a6
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/os/FileStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2731,14 +2731,10 @@ int FileStore::_clone(coll_t cid, const hobject_t& oldoid, const hobject_t& newo
r = n;
goto out;
}
if (btrfs)
r = ::ioctl(n, BTRFS_IOC_CLONE, o);
else {
struct stat st;
::fstat(o, &st);
dout(10) << "clone " << cid << "/" << oldoid << " -> " << cid << "/" << newoid << " READ+WRITE" << dendl;
r = _do_clone_range(o, n, 0, st.st_size, 0);
}

struct stat st;
::fstat(o, &st);
r = _do_clone_range(o, n, 0, st.st_size, 0);
if (r < 0)
r = -errno;

Expand Down

0 comments on commit 86a54a6

Please sign in to comment.