]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iomap: iomap_write_end cleanup
authorAndreas Gruenbacher <agruenba@redhat.com>
Fri, 6 May 2022 01:19:13 +0000 (18:19 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Sun, 8 May 2022 21:47:42 +0000 (14:47 -0700)
In iomap_write_end(), only call iomap_write_failed() on the byte range
that has failed.  This should improve code readability, but doesn't fix
an actual bug because iomap_write_failed() is called after updating the
file size here and it only affects the memory beyond the end of the
file.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
fs/iomap/buffered-io.c

index 358ee1fb6f0dbccebe62ea1a45230dffb41c2dc4..8fb9b2797fc5a0096cf552b418ed00c69c70e305 100644 (file)
@@ -734,7 +734,7 @@ static size_t iomap_write_end(struct iomap_iter *iter, loff_t pos, size_t len,
        folio_put(folio);
 
        if (ret < len)
-               iomap_write_failed(iter->inode, pos, len);
+               iomap_write_failed(iter->inode, pos + ret, len - ret);
        return ret;
 }