os/filestore: fix coll_t handling for CLONERANGE[2]

Signed-off-by: Manali Kulkarni <Manali.Kulkarni@sandisk.com>
This commit is contained in:
Manali Kulkarni 2016-09-27 10:22:23 -04:00 committed by Sage Weil
parent e15cdb3242
commit 50ae9a3cf6
2 changed files with 15 additions and 13 deletions

View File

@ -2669,13 +2669,14 @@ void FileStore::_do_transaction(
{
coll_t cid = i.get_cid(op->cid);
ghobject_t oid = i.get_oid(op->oid);
_kludge_temp_object_collection(cid, oid);
coll_t ncid = cid;
ghobject_t noid = i.get_oid(op->dest_oid);
_kludge_temp_object_collection(cid, noid);
_kludge_temp_object_collection(cid, oid);
_kludge_temp_object_collection(ncid, noid);
uint64_t off = op->off;
uint64_t len = op->len;
tracepoint(objectstore, clone_range_enter, osr_name, len);
r = _clone_range(cid, oid, noid, off, len, off, spos);
r = _clone_range(cid, oid, ncid, noid, off, len, off, spos);
tracepoint(objectstore, clone_range_exit, r);
}
break;
@ -2684,14 +2685,15 @@ void FileStore::_do_transaction(
{
coll_t cid = i.get_cid(op->cid);
ghobject_t oid = i.get_oid(op->oid);
_kludge_temp_object_collection(cid, oid);
coll_t ncid = cid;
ghobject_t noid = i.get_oid(op->dest_oid);
_kludge_temp_object_collection(cid, noid);
_kludge_temp_object_collection(cid, oid);
_kludge_temp_object_collection(ncid, noid);
uint64_t srcoff = op->off;
uint64_t len = op->len;
uint64_t dstoff = op->dest_off;
tracepoint(objectstore, clone_range2_enter, osr_name, len);
r = _clone_range(cid, oid, noid, srcoff, len, dstoff, spos);
r = _clone_range(cid, oid, ncid, noid, srcoff, len, dstoff, spos);
tracepoint(objectstore, clone_range2_exit, r);
}
break;
@ -3709,22 +3711,22 @@ int FileStore::_do_copy_range(int from, int to, uint64_t srcoff, uint64_t len, u
return r;
}
int FileStore::_clone_range(const coll_t& cid, const ghobject_t& oldoid, const ghobject_t& newoid,
int FileStore::_clone_range(const coll_t& oldcid, const ghobject_t& oldoid, const coll_t& newcid, const ghobject_t& newoid,
uint64_t srcoff, uint64_t len, uint64_t dstoff,
const SequencerPosition& spos)
{
dout(15) << "clone_range " << cid << "/" << oldoid << " -> " << cid << "/" << newoid << " " << srcoff << "~" << len << " to " << dstoff << dendl;
dout(15) << "clone_range " << oldcid << "/" << oldoid << " -> " << newcid << "/" << newoid << " " << srcoff << "~" << len << " to " << dstoff << dendl;
if (_check_replay_guard(cid, newoid, spos) < 0)
if (_check_replay_guard(newcid, newoid, spos) < 0)
return 0;
int r;
FDRef o, n;
r = lfn_open(cid, oldoid, false, &o);
r = lfn_open(oldcid, oldoid, false, &o);
if (r < 0) {
goto out2;
}
r = lfn_open(cid, newoid, true, &n);
r = lfn_open(newcid, newoid, true, &n);
if (r < 0) {
goto out;
}
@ -3741,7 +3743,7 @@ int FileStore::_clone_range(const coll_t& cid, const ghobject_t& oldoid, const g
out:
lfn_close(o);
out2:
dout(10) << "clone_range " << cid << "/" << oldoid << " -> " << cid << "/" << newoid << " "
dout(10) << "clone_range " << oldcid << "/" << oldoid << " -> " << newcid << "/" << newoid << " "
<< srcoff << "~" << len << " to " << dstoff << " = " << r << dendl;
return r;
}

View File

@ -557,7 +557,7 @@ public:
int _truncate(const coll_t& cid, const ghobject_t& oid, uint64_t size);
int _clone(const coll_t& cid, const ghobject_t& oldoid, const ghobject_t& newoid,
const SequencerPosition& spos);
int _clone_range(const coll_t& cid, const ghobject_t& oldoid, const ghobject_t& newoid,
int _clone_range(const coll_t& oldcid, const ghobject_t& oldoid, const coll_t& newcid, const ghobject_t& newoid,
uint64_t srcoff, uint64_t len, uint64_t dstoff,
const SequencerPosition& spos);
int _do_clone_range(int from, int to, uint64_t srcoff, uint64_t len, uint64_t dstoff);