summaryrefslogtreecommitdiffstats
path: root/fs/iomap
diff options
context:
space:
mode:
authorKaixu Xia <kaixuxia@tencent.com>2022-06-30 10:04:18 -0700
committerDarrick J. Wong <djwong@kernel.org>2022-06-30 10:04:18 -0700
commit98eb8d95025bd96d78fa4d27fb9e1e8d162c7227 (patch)
treec3d8dda69434c615ffbcc9b6d8c8ca459119fc6f /fs/iomap
parentd58562ca6c992fc5577838d010c8a37401c2a831 (diff)
downloadlinux-98eb8d95025bd96d78fa4d27fb9e1e8d162c7227.tar.gz
linux-98eb8d95025bd96d78fa4d27fb9e1e8d162c7227.tar.bz2
linux-98eb8d95025bd96d78fa4d27fb9e1e8d162c7227.zip
iomap: set did_zero to true when zeroing successfully
It is unnecessary to check and set did_zero value in while() loop in iomap_zero_iter(), we can set did_zero to true only when zeroing successfully at last. Signed-off-by: Kaixu Xia <kaixuxia@tencent.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/iomap')
-rw-r--r--fs/iomap/buffered-io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 02b8bb46e0b3..afd260632836 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -917,10 +917,10 @@ static loff_t iomap_zero_iter(struct iomap_iter *iter, bool *did_zero)
pos += bytes;
length -= bytes;
written += bytes;
- if (did_zero)
- *did_zero = true;
} while (length > 0);
+ if (did_zero)
+ *did_zero = true;
return written;
}