Skip to content

Commit 0da7a2a

Browse files
committed
os/bluestore: In BlueFS::truncate accept wierd alloc_unit
The alignment of extents might not reflect current alloc_unit[bdev]. It might be caused be either fallback to alternate AU size for SLOW, or change of allocation unit in DB or WAL. In such cases, truncation just leaves extent untouched. Fixes: https://tracker.ceph.com/issues/71235 Signed-off-by: Adam Kupczyk <[email protected]>
1 parent 9238442 commit 0da7a2a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/os/bluestore/BlueFS.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4224,10 +4224,12 @@ int BlueFS::truncate(FileWriter *h, uint64_t offset)/*_WF_L*/
42244224
changed_extents = true;
42254225
++p;
42264226
} else {
4227-
// cut_off > p->length means that we misaligned the extent
4228-
ceph_assert(cut_off == p->length);
4227+
// Usually cut_off == p->length.
4228+
// Case cut_off > p->length means that we misaligned the extent
4229+
// or alloc size changed in the meantime.
4230+
// In both cases just leave extent untouched.
42294231
fnode.allocated = (offset - x_off) + p->length;
4230-
++p; // leave extent untouched
4232+
++p;
42314233
}
42324234
while (p != fnode.extents.end()) {
42334235
dirty.pending_release[p->bdev].insert(p->offset, p->length);

0 commit comments

Comments
 (0)