mirror of
https://github.com/ceph/ceph
synced 2025-01-20 18:21:57 +00:00
rbd: check for all-zero buf in export, seek output if so
Use buf_is_zero in common/util.cc Signed-off-by: Dan Mick <dan.mick@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
This commit is contained in:
parent
4a558048cf
commit
410903fe7a
@ -440,7 +440,7 @@ radosacl_SOURCES = radosacl.cc
|
||||
radosacl_LDADD = librados.la $(PTHREAD_LIBS) -lm $(CRYPTO_LIBS) $(EXTRALIBS)
|
||||
bin_DEBUGPROGRAMS += scratchtool scratchtoolpp radosacl
|
||||
|
||||
rbd_SOURCES = rbd.cc common/fiemap.cc common/secret.c common/TextTable.cc
|
||||
rbd_SOURCES = rbd.cc common/fiemap.cc common/secret.c common/TextTable.cc common/util.cc
|
||||
rbd_CXXFLAGS = ${AM_CXXFLAGS}
|
||||
rbd_LDADD = libglobal.la librbd.la librados.la $(PTHREAD_LIBS) -lm -lkeyutils $(CRYPTO_LIBS) $(EXTRALIBS)
|
||||
if LINUX
|
||||
|
@ -46,6 +46,7 @@
|
||||
|
||||
#include "include/rbd_types.h"
|
||||
#include "common/TextTable.h"
|
||||
#include "include/util.h"
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <linux/fs.h>
|
||||
@ -721,8 +722,10 @@ static int export_read_cb(uint64_t ofs, size_t len, const char *buf, void *arg)
|
||||
ret = write(fd, buf, len);
|
||||
}
|
||||
} else { // not stdout
|
||||
if (!buf) /* a hole */
|
||||
if (!buf || buf_is_zero(buf, len)) {
|
||||
/* a hole */
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = lseek64(fd, ofs, SEEK_SET);
|
||||
if (ret < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user