From 884a668a9c3e12e17d64ebd5ccd9fbf3d203fd1e Mon Sep 17 00:00:00 2001 From: Bharata B Rao Date: Fri, 15 Nov 2013 10:11:58 +0530 Subject: zerofill: Change the type of len argument of glfs_zerofill() to off_t glfs_zerofill() can be potentially called to zero-out entire file and hence allow for bigger value of length parameter. Change-Id: I75f1d11af298915049a3f3a7cb3890a2d72fca63 BUG: 1028673 Signed-off-by: Bharata B Rao Reviewed-on: http://review.gluster.org/6266 Tested-by: Gluster Build System Reviewed-by: M. Mohan Kumar Tested-by: M. Mohan Kumar Reviewed-by: Anand Avati --- api/src/glfs-fops.c | 4 ++-- api/src/glfs.h | 4 ++-- libglusterfs/src/call-stub.c | 2 +- libglusterfs/src/call-stub.h | 2 +- libglusterfs/src/defaults.c | 4 ++-- libglusterfs/src/defaults.h | 4 ++-- libglusterfs/src/syncop.c | 2 +- libglusterfs/src/syncop.h | 2 +- libglusterfs/src/xlator.h | 2 +- xlators/cluster/afr/src/afr-inode-write.c | 2 +- xlators/cluster/afr/src/afr-inode-write.h | 2 +- xlators/cluster/afr/src/afr.h | 2 +- xlators/cluster/dht/src/dht-common.h | 2 +- xlators/cluster/dht/src/dht-inode-write.c | 2 +- xlators/cluster/stripe/src/stripe.c | 2 +- xlators/debug/io-stats/src/io-stats.c | 2 +- xlators/features/marker/src/marker.c | 2 +- xlators/performance/io-cache/src/io-cache.c | 2 +- xlators/performance/io-threads/src/io-threads.c | 4 ++-- xlators/performance/md-cache/src/md-cache.c | 2 +- xlators/performance/open-behind/src/open-behind.c | 2 +- xlators/performance/read-ahead/src/read-ahead.c | 2 +- xlators/protocol/client/src/client.c | 2 +- xlators/storage/posix/src/posix.c | 16 ++++++++-------- 24 files changed, 36 insertions(+), 36 deletions(-) diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index 10bb7d38b..93c5101a0 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -1877,7 +1877,7 @@ glfs_discard_async (struct glfs_fd *glfd, off_t offset, size_t len, } int -glfs_zerofill_async (struct glfs_fd *glfd, off_t offset, size_t len, +glfs_zerofill_async (struct glfs_fd *glfd, off_t offset, off_t len, glfs_io_cbk fn, void *data) { struct glfs_io *gio = NULL; @@ -2927,7 +2927,7 @@ out: } int -glfs_zerofill (struct glfs_fd *glfd, off_t offset, size_t len) +glfs_zerofill (struct glfs_fd *glfd, off_t offset, off_t len) { int ret = -1; xlator_t *subvol = NULL; diff --git a/api/src/glfs.h b/api/src/glfs.h index 18fda496e..bf298ce47 100644 --- a/api/src/glfs.h +++ b/api/src/glfs.h @@ -556,9 +556,9 @@ int glfs_discard(glfs_fd_t *fd, off_t offset, size_t len); int glfs_discard_async (glfs_fd_t *fd, off_t length, size_t lent, glfs_io_cbk fn, void *data); -int glfs_zerofill(glfs_fd_t *fd, off_t offset, size_t len); +int glfs_zerofill(glfs_fd_t *fd, off_t offset, off_t len); -int glfs_zerofill_async (glfs_fd_t *fd, off_t length, size_t len, +int glfs_zerofill_async (glfs_fd_t *fd, off_t length, off_t len, glfs_io_cbk fn, void *data); char *glfs_getcwd (glfs_t *fs, char *buf, size_t size); diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index ac79cf071..7e94ee3c0 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -2271,7 +2271,7 @@ out: call_stub_t * fop_zerofill_stub(call_frame_t *frame, fop_zerofill_t fn, fd_t *fd, - off_t offset, size_t len, dict_t *xdata) + off_t offset, off_t len, dict_t *xdata) { call_stub_t *stub = NULL; diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h index 45bef8044..0f6c108ee 100644 --- a/libglusterfs/src/call-stub.h +++ b/libglusterfs/src/call-stub.h @@ -752,7 +752,7 @@ fop_zerofill_stub(call_frame_t *frame, fop_zerofill_t fn, fd_t *fd, off_t offset, - size_t len, dict_t *xdata); + off_t len, dict_t *xdata); call_stub_t * fop_zerofill_cbk_stub(call_frame_t *frame, diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c index 2ebb25150..e6b1287f9 100644 --- a/libglusterfs/src/defaults.c +++ b/libglusterfs/src/defaults.c @@ -913,7 +913,7 @@ default_discard_resume(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t default_zerofill_resume(call_frame_t *frame, xlator_t *this, fd_t *fd, - off_t offset, size_t len, dict_t *xdata) + off_t offset, off_t len, dict_t *xdata) { STACK_WIND(frame, default_zerofill_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->zerofill, fd, offset, len, @@ -1348,7 +1348,7 @@ default_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t default_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, - off_t offset, size_t len, dict_t *xdata) + off_t offset, off_t len, dict_t *xdata) { STACK_WIND_TAIL(frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->zerofill, fd, offset, len, diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h index 0747027bc..0fb5572ac 100644 --- a/libglusterfs/src/defaults.h +++ b/libglusterfs/src/defaults.h @@ -259,7 +259,7 @@ int32_t default_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata); + off_t len, dict_t *xdata); /* Resume */ @@ -488,7 +488,7 @@ int32_t default_zerofill_resume(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata); + off_t len, dict_t *xdata); /* _cbk */ diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index c1620bb70..25baa021a 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -2191,7 +2191,7 @@ syncop_zerofill_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } int -syncop_zerofill(xlator_t *subvol, fd_t *fd, off_t offset, size_t len) +syncop_zerofill(xlator_t *subvol, fd_t *fd, off_t offset, off_t len) { struct syncargs args = {0, }; diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h index f790981f0..18519ff47 100644 --- a/libglusterfs/src/syncop.h +++ b/libglusterfs/src/syncop.h @@ -403,7 +403,7 @@ int syncop_fallocate(xlator_t *subvol, fd_t *fd, int32_t keep_size, off_t offset size_t len); int syncop_discard(xlator_t *subvol, fd_t *fd, off_t offset, size_t len); -int syncop_zerofill(xlator_t *subvol, fd_t *fd, off_t offset, size_t len); +int syncop_zerofill(xlator_t *subvol, fd_t *fd, off_t offset, off_t len); int syncop_rename (xlator_t *subvol, loc_t *oldloc, loc_t *newloc); diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index b57e5873e..2f3bc9d6f 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -677,7 +677,7 @@ typedef int32_t (*fop_zerofill_t) (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, + off_t len, dict_t *xdata); struct xlator_fops { diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c index c1ec69a55..d62847def 100644 --- a/xlators/cluster/afr/src/afr-inode-write.c +++ b/xlators/cluster/afr/src/afr-inode-write.c @@ -2807,7 +2807,7 @@ out: int afr_zerofill (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata) + off_t len, dict_t *xdata) { afr_private_t *priv = NULL; afr_local_t *local = NULL; diff --git a/xlators/cluster/afr/src/afr-inode-write.h b/xlators/cluster/afr/src/afr-inode-write.h index 8e93ca44a..7b1fc5528 100644 --- a/xlators/cluster/afr/src/afr-inode-write.h +++ b/xlators/cluster/afr/src/afr-inode-write.h @@ -78,5 +78,5 @@ afr_fallocate (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, int afr_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata); + off_t len, dict_t *xdata); #endif /* __INODE_WRITE_H__ */ diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 21064db58..dcf0f8d0c 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -712,7 +712,7 @@ typedef struct _afr_local { struct { off_t offset; - size_t len; + off_t len; struct iatt prebuf; struct iatt postbuf; } zerofill; diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 5ccd66799..7564c600b 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -696,7 +696,7 @@ int32_t dht_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t dht_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, size_t len, dict_t *xdata); int32_t dht_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, - off_t offset, size_t len, dict_t *xdata); + off_t offset, off_t len, dict_t *xdata); int32_t dht_init (xlator_t *this); void dht_fini (xlator_t *this); diff --git a/xlators/cluster/dht/src/dht-inode-write.c b/xlators/cluster/dht/src/dht-inode-write.c index 4b3f3a049..1ba98473e 100644 --- a/xlators/cluster/dht/src/dht-inode-write.c +++ b/xlators/cluster/dht/src/dht-inode-write.c @@ -707,7 +707,7 @@ dht_zerofill2(xlator_t *this, call_frame_t *frame, int op_ret) int dht_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata) + off_t len, dict_t *xdata) { xlator_t *subvol = NULL; int op_errno = -1; diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index 69b510e23..fa718a3e4 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -4172,7 +4172,7 @@ out: int32_t stripe_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata) + off_t len, dict_t *xdata) { stripe_local_t *local = NULL; stripe_fd_ctx_t *fctx = NULL; diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 7fb697ae4..3ca57753c 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -2453,7 +2453,7 @@ io_stats_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, int io_stats_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata) + off_t len, dict_t *xdata) { START_FOP_LATENCY(frame); diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index 6a2c85691..6df1f5688 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -1991,7 +1991,7 @@ out: int32_t marker_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata) + off_t len, dict_t *xdata) { int32_t ret = 0; marker_local_t *local = NULL; diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index 201777b38..054d28c03 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -1461,7 +1461,7 @@ ioc_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this, static int32_t ioc_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata) + off_t len, dict_t *xdata) { uint64_t ioc_inode = 0; diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index bbcf4ed26..4dd7a9973 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -2522,7 +2522,7 @@ iot_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int iot_zerofill_wrapper(call_frame_t *frame, xlator_t *this, fd_t *fd, - off_t offset, size_t len, dict_t *xdata) + off_t offset, off_t len, dict_t *xdata) { STACK_WIND (frame, iot_zerofill_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->zerofill, fd, offset, len, xdata); @@ -2531,7 +2531,7 @@ iot_zerofill_wrapper(call_frame_t *frame, xlator_t *this, fd_t *fd, int iot_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata) + off_t len, dict_t *xdata) { call_stub_t *stub = NULL; int ret = -1; diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c index 84c363ad9..ef156e309 100644 --- a/xlators/performance/md-cache/src/md-cache.c +++ b/xlators/performance/md-cache/src/md-cache.c @@ -2122,7 +2122,7 @@ out: } int mdc_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata) + off_t len, dict_t *xdata) { mdc_local_t *local; diff --git a/xlators/performance/open-behind/src/open-behind.c b/xlators/performance/open-behind/src/open-behind.c index 7e5b57278..29ef64364 100644 --- a/xlators/performance/open-behind/src/open-behind.c +++ b/xlators/performance/open-behind/src/open-behind.c @@ -721,7 +721,7 @@ err: int ob_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata) + off_t len, dict_t *xdata) { call_stub_t *stub; diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c index 069ab1f1a..6e2d84591 100644 --- a/xlators/performance/read-ahead/src/read-ahead.c +++ b/xlators/performance/read-ahead/src/read-ahead.c @@ -1006,7 +1006,7 @@ ra_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this, static int ra_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata) + off_t len, dict_t *xdata) { ra_file_t *file = NULL; fd_t *iter_fd = NULL; diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index 1f7d13ea4..ac3fcb117 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -2032,7 +2032,7 @@ out: int32_t client_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata) + off_t len, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index fb45c7a67..768ab4929 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -634,15 +634,15 @@ out: } static int32_t -_posix_do_zerofill(int fd, off_t offset, size_t len, int o_direct) +_posix_do_zerofill(int fd, off_t offset, off_t len, int o_direct) { - size_t num_vect = 0; - int32_t num_loop = 1; - int32_t idx = 0; + off_t num_vect = 0; + off_t num_loop = 1; + off_t idx = 0; int32_t op_ret = -1; int32_t vect_size = VECTOR_SIZE; - size_t remain = 0; - size_t extra = 0; + off_t remain = 0; + off_t extra = 0; struct iovec *vector = NULL; char *iov_base = NULL; char *alloc_buf = NULL; @@ -714,7 +714,7 @@ err: static int32_t posix_do_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, - off_t offset, size_t len, struct iatt *statpre, + off_t offset, off_t len, struct iatt *statpre, struct iatt *statpost) { struct posix_fd *pfd = NULL; @@ -827,7 +827,7 @@ err: static int32_t posix_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata) + off_t len, dict_t *xdata) { int32_t ret = 0; struct iatt statpre = {0,}; -- cgit