diff options
author | Dan Mick <dan.mick@inktank.com> | 2012-12-07 16:43:24 -0800 |
---|---|---|
committer | Dan Mick <dan.mick@inktank.com> | 2012-12-07 16:43:46 -0800 |
commit | f9d090ef1af77295070c68552f3f82a78951332b (patch) | |
tree | 2219dabbf86c8ae91f185e3a0917f3eef0b3484c | |
parent | 13e3e5866c607e7e20f3680a77637057fc9c48fd (diff) | |
parent | 835573302707b5ccee1ab2dad6c7a11670cb395b (diff) | |
download | ceph-f9d090ef1af77295070c68552f3f82a78951332b.tar.gz |
Merge branch 'next'
Merge of wip-rbd-export-progress
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
-rw-r--r-- | src/rbd.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rbd.cc b/src/rbd.cc index 3c82382f6e3..3db89787126 100644 --- a/src/rbd.cc +++ b/src/rbd.cc @@ -668,9 +668,10 @@ static int do_bench_write(librbd::Image& image, uint64_t io_size, uint64_t io_th struct ExportContext { int fd; + uint64_t totalsize; MyProgressContext pc; - ExportContext(int f) : fd(f), pc("Exporting image") {} + ExportContext(int f, uint64_t t) : fd(f), totalsize(t), pc("Exporting image") {} }; static int export_read_cb(uint64_t ofs, size_t len, const char *buf, void *arg) @@ -715,6 +716,7 @@ static int export_read_cb(uint64_t ofs, size_t len, const char *buf, void *arg) if (ret < 0) return -errno; ret = write(fd, buf, len); + ec->pc.update_progress(ofs, ec->totalsize); } if (ret < 0) @@ -740,7 +742,7 @@ static int do_export(librbd::Image& image, const char *path) if (fd < 0) return -errno; - ExportContext ec(fd); + ExportContext ec(fd, info.size); r = image.read_iterate(0, info.size, export_read_cb, (void *)&ec); if (r < 0) goto out; |