Skip to content

Commit

Permalink
iomap: set did_zero to true when zeroing successfully
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Chaitanya Kulkarni <[email protected]>
Reviewed-by: Darrick J. Wong <[email protected]>
Signed-off-by: Darrick J. Wong <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
  • Loading branch information
kaixuxiakx authored and Darrick J. Wong committed Jun 30, 2022
1 parent d58562c commit 98eb8d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/iomap/buffered-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 98eb8d9

Please sign in to comment.