* [PATCH] iomap: set did_zero to true when zeroing successfully
@ 2022-06-14 9:14 xiakaixu1987
2022-06-15 22:07 ` Chaitanya Kulkarni
2022-06-16 7:28 ` Christoph Hellwig
0 siblings, 2 replies; 4+ messages in thread
From: xiakaixu1987 @ 2022-06-14 9:14 UTC (permalink / raw)
To: linux-xfs, linux-fsdevel; +Cc: djwong, hch, Kaixu Xia
From: Kaixu Xia <kaixuxia@tencent.com>
It is unnecessary to check and set did_zero value in while() loop,
we can set did_zero to true only when zeroing successfully at last.
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
---
fs/dax.c | 4 ++--
fs/iomap/buffered-io.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/dax.c b/fs/dax.c
index 4155a6107fa1..649ff51c9a26 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1088,10 +1088,10 @@ static s64 dax_zero_iter(struct iomap_iter *iter, bool *did_zero)
pos += size;
length -= size;
written += size;
- if (did_zero)
- *did_zero = true;
} while (length > 0);
+ if (did_zero)
+ *did_zero = true;
return written;
}
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index d2a9f699e17e..1cadb24a1498 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;
}
--
2.27.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] iomap: set did_zero to true when zeroing successfully
2022-06-14 9:14 [PATCH] iomap: set did_zero to true when zeroing successfully xiakaixu1987
@ 2022-06-15 22:07 ` Chaitanya Kulkarni
2022-06-16 7:28 ` Christoph Hellwig
1 sibling, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2022-06-15 22:07 UTC (permalink / raw)
To: xiakaixu1987; +Cc: djwong, linux-xfs, linux-fsdevel, hch, Kaixu Xia
On 6/14/22 02:14, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
>
> It is unnecessary to check and set did_zero value in while() loop,
> we can set did_zero to true only when zeroing successfully at last.
>
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
> ---
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iomap: set did_zero to true when zeroing successfully
2022-06-14 9:14 [PATCH] iomap: set did_zero to true when zeroing successfully xiakaixu1987
2022-06-15 22:07 ` Chaitanya Kulkarni
@ 2022-06-16 7:28 ` Christoph Hellwig
2022-06-16 11:14 ` Kaixu Xia
1 sibling, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2022-06-16 7:28 UTC (permalink / raw)
To: xiakaixu1987; +Cc: linux-xfs, linux-fsdevel, djwong, hch, Kaixu Xia
On Tue, Jun 14, 2022 at 05:14:22PM +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
>
> It is unnecessary to check and set did_zero value in while() loop,
> we can set did_zero to true only when zeroing successfully at last.
Looks good, but this really should be separate patches for dax and
iomap.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iomap: set did_zero to true when zeroing successfully
2022-06-16 7:28 ` Christoph Hellwig
@ 2022-06-16 11:14 ` Kaixu Xia
0 siblings, 0 replies; 4+ messages in thread
From: Kaixu Xia @ 2022-06-16 11:14 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs, linux-fsdevel, djwong, Kaixu Xia
Christoph Hellwig <hch@infradead.org> 于2022年6月16日周四 15:28写道:
>
> On Tue, Jun 14, 2022 at 05:14:22PM +0800, xiakaixu1987@gmail.com wrote:
> > From: Kaixu Xia <kaixuxia@tencent.com>
> >
> > It is unnecessary to check and set did_zero value in while() loop,
> > we can set did_zero to true only when zeroing successfully at last.
>
> Looks good, but this really should be separate patches for dax and
> iomap.
Thanks for your suggestion, will separate it in V2.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-06-16 11:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14 9:14 [PATCH] iomap: set did_zero to true when zeroing successfully xiakaixu1987
2022-06-15 22:07 ` Chaitanya Kulkarni
2022-06-16 7:28 ` Christoph Hellwig
2022-06-16 11:14 ` Kaixu Xia
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.