On Mon, Aug 6, 2018 at 9:10 AM Will Zhao <zhao6305@xxxxxxxxx> wrote: > > Hi all: extern "C" int rbd_discard(rbd_image_t image, uint64_t ofs, > uint64_t len) > { > librbd::ImageCtx *ictx = (librbd::ImageCtx *)image; > tracepoint(librbd, discard_enter, ictx, ictx->name.c_str(), > ictx->snap_name.c_str(), ictx->read_only, ofs, len); > if (len > std::numeric_limits<int>::max()) { > tracepoint(librbd, discard_exit, -EINVAL); > return -EINVAL; > } > int r = ictx->io_work_queue->discard(ofs, len, ictx->skip_partial_discard); > tracepoint(librbd, discard_exit, r); > return r; > } > I tried to call rbd python api, rbd.Image.discard , and I found there > is limit to the parameter len , it is a uint64, but is limited by > std::numeric_limits<int>::max(), so that I can't discard too large > space at a time. So I wonder what the considerations are about this? rbd_discard() returns the number of bytes discarded or a negative error code. The return type is just an int though, so the range is capped at INT_MAX to avoid overflow. On top of that, current librbd doesn't rate limit on OSD requests in all cases, so huge discards would need to be rejected anyway (although the limit would probably be higher than ~2G). Once that is fixed, a new version of rbd_discard() with an updated signature could be added. Thanks, Ilya _______________________________________________ ceph-users mailing list ceph-users@xxxxxxxxxxxxxx http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com