aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/page-io.c
diff options
context:
space:
mode:
authorBaokun Li <[email protected]>2025-01-22 11:05:25 +0000
committerTheodore Ts'o <[email protected]>2025-03-13 14:08:08 +0000
commit2f94b537c48db155f5aa68d63b747f9d82248341 (patch)
treea17141788b509025b166ee86be6afdcc27f6c75b /fs/ext4/page-io.c
parentext4: fix potential null dereference in ext4 kunit test (diff)
downloadkernel-2f94b537c48db155f5aa68d63b747f9d82248341.tar.gz
kernel-2f94b537c48db155f5aa68d63b747f9d82248341.zip
ext4: replace opencoded ext4_end_io_end() in ext4_put_io_end()
This reduces duplicate code and ensures that a “potential data loss” warning is available if the unwritten conversion fails. Signed-off-by: Baokun Li <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Zhang Yi <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
Diffstat (limited to 'fs/ext4/page-io.c')
-rw-r--r--fs/ext4/page-io.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index 69b8a7221a2b..f53b018ea259 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -299,18 +299,13 @@ void ext4_put_io_end_defer(ext4_io_end_t *io_end)
int ext4_put_io_end(ext4_io_end_t *io_end)
{
- int err = 0;
-
if (refcount_dec_and_test(&io_end->count)) {
- if (io_end->flag & EXT4_IO_END_UNWRITTEN) {
- err = ext4_convert_unwritten_io_end_vec(io_end->handle,
- io_end);
- io_end->handle = NULL;
- ext4_clear_io_unwritten_flag(io_end);
- }
+ if (io_end->flag & EXT4_IO_END_UNWRITTEN)
+ return ext4_end_io_end(io_end);
+
ext4_release_io_end(io_end);
}
- return err;
+ return 0;
}
ext4_io_end_t *ext4_get_io_end(ext4_io_end_t *io_end)