From 4ddbbf5467518d55130f5e5d1839f42efef0783c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 19 Apr 2012 16:18:55 -0700 Subject: [PATCH] librbd: allow image resize to non-block boundaries The caller is still invalidating the entire cache, so we don't need to deal with discard at this level. That might be worth cleaning up later, though. Fixes: #2296 Signed-off-by: Sage Weil --- src/librbd.cc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/librbd.cc b/src/librbd.cc index c9bfb5efff5a9..029f043db58d3 100644 --- a/src/librbd.cc +++ b/src/librbd.cc @@ -570,11 +570,23 @@ void trim_image(IoCtx& io_ctx, const rbd_obj_header_ondisk &header, uint64_t new uint64_t bsize = get_block_size(header); uint64_t numseg = get_max_block(header); uint64_t start = get_block_num(header, newsize); - ldout(cct, 2) << "trimming image data from " << numseg << " to " << start << " objects..." << dendl; - for (uint64_t i=start; i