Message ID | 1508210445-27135-1-git-send-email-houtao1@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, Oct 17, 2017 at 6:20 AM, Hou Tao <houtao1@huawei.com> wrote: > Found it when trying to remove the limitation of log->max_zero_size. > > Signed-off-by: Hou Tao <houtao1@huawei.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> > --- > src/log-writes/log-writes.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/src/log-writes/log-writes.c b/src/log-writes/log-writes.c > index fab447a..0939157 100644 > --- a/src/log-writes/log-writes.c > +++ b/src/log-writes/log-writes.c > @@ -65,6 +65,9 @@ static int zero_range(struct log *log, u64 start, u64 len) > > memset(buf, 0, bufsize); > while (len) { > + if (len < bufsize) > + bufsize = len; > + > ret = pwrite(log->replayfd, buf, bufsize, start); > if (ret != bufsize) { > fprintf(stderr, "Error zeroing file: %d\n", errno); > -- > 2.5.0 > > -- > To unsubscribe from this list: send the line "unsubscribe fstests" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/src/log-writes/log-writes.c b/src/log-writes/log-writes.c index fab447a..0939157 100644 --- a/src/log-writes/log-writes.c +++ b/src/log-writes/log-writes.c @@ -65,6 +65,9 @@ static int zero_range(struct log *log, u64 start, u64 len) memset(buf, 0, bufsize); while (len) { + if (len < bufsize) + bufsize = len; + ret = pwrite(log->replayfd, buf, bufsize, start); if (ret != bufsize) { fprintf(stderr, "Error zeroing file: %d\n", errno);
Found it when trying to remove the limitation of log->max_zero_size. Signed-off-by: Hou Tao <houtao1@huawei.com> --- src/log-writes/log-writes.c | 3 +++ 1 file changed, 3 insertions(+)