Re: [ceph-users] a little question about rbd_discard parameter len

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux