Skip to content

Commit 38dc888

Browse files
Christoph Hellwigkdave
authored andcommitted
btrfs: consolidate the error handling in run_delalloc_nocow
Share the calls to extent_clear_unlock_delalloc for btrfs_path allocation failure handling and the normal exit path. This relies on btrfs_free_path ignoring a NULL pointer, and the initialization of cur_offset to start at the beginning of the function. Reviewed-by: Boris Burkov <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 18f62b8 commit 38dc888

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

fs/btrfs/inode.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,13 +1978,8 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode,
19781978

19791979
path = btrfs_alloc_path();
19801980
if (!path) {
1981-
extent_clear_unlock_delalloc(inode, start, end, locked_page,
1982-
EXTENT_LOCKED | EXTENT_DELALLOC |
1983-
EXTENT_DO_ACCOUNTING |
1984-
EXTENT_DEFRAG, PAGE_UNLOCK |
1985-
PAGE_START_WRITEBACK |
1986-
PAGE_END_WRITEBACK);
1987-
return -ENOMEM;
1981+
ret = -ENOMEM;
1982+
goto error;
19881983
}
19891984

19901985
nocow_args.end = end;

0 commit comments

Comments
 (0)