os/bluestore: fix writes that span existing shard boundaries #11451

Merged
merged 2 commits into from Oct 13, 2016

Projects

None yet

2 participants

@liewegas
Member
liewegas commented Oct 12, 2016 edited

For now I take the simple strategy and force a reshard if we happen to write across a boundary. I susepct the optimal solution is a bit more nuanced. For example, big writes could be split, but small writes probably shouldn't be. Or, better yet, this sort of write could just move the shard boundary over, or otherwise trigger a partial reshard. I'm happy leaving that for future work, though!

@liewegas liewegas os/bluestore: remove dead code from reshard()
Signed-off-by: Sage Weil <sage@redhat.com>
1906ac9
@ifed01 ifed01 was assigned by liewegas Oct 12, 2016
src/os/bluestore/BlueStore.cc
@@ -1675,6 +1676,7 @@ void BlueStore::ExtentMap::reshard(Onode *o, uint64_t min_alloc_size)
}
}
}
+ needs_reshard = false;
@ifed01
ifed01 Oct 13, 2016 Contributor

Put that at function entrance to cover returns from the mid of the func?

src/os/bluestore/BlueStore.h
+ if (shards.empty()) {
+ return false;
+ }
+ size_t s = seek_shard(offset);
@ifed01
ifed01 Oct 13, 2016 Contributor

seek_shard returns int

@ifed01
ifed01 Oct 13, 2016 Contributor

handling for not found shard? Or assert(s>=0) if this is unexpected.

src/os/bluestore/BlueStore.cc
@@ -2088,6 +2090,9 @@ BlueStore::Extent *BlueStore::ExtentMap::set_lextent(
b->ref_map.get(offset, length);
Extent *le = new Extent(logical_offset, offset, length, blob_depth, b);
extent_map.insert(*le);
+ if (spans_shard(offset, length)) {
@ifed01
ifed01 Oct 13, 2016 Contributor

replace with if( !needs_reshard && spans_shard....)?

@ifed01
Contributor
ifed01 commented Oct 13, 2016

LGTM except mentioned nits

@liewegas liewegas os/bluestore: force reshard if new extent spans shard boundary
A new write may create a new lextent that spans an
existing shard boundary.  If that happens, set a flag
so that we force a reshard when the onode is written.

Signed-off-by: Sage Weil <sage@redhat.com>
c908cae
@liewegas liewegas merged commit 37c27f0 into ceph:master Oct 13, 2016

1 of 2 checks passed

default Build started sha1 is merged.
Details
Signed-off-by all commits in this PR are signed
Details
@liewegas liewegas deleted the liewegas:wip-bluestore-reshard-fixes branch Oct 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment