Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1716398
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/5] btrfs: Use common error handling code in tree_mod_log_eb_copy() |
| Date | 2017-08-21 14:40 +0200 |
| Message-ID | <ugU9P-4ml-9@gated-at.bofh.it> (permalink) |
| References | <ugU9P-4ml-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 21 Aug 2017 09:36:48 +0200
Add a jump target so that a bit of exception handling can be better reused
in this function.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
fs/btrfs/ctree.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 6d49db7d86be..d29cf946ebf9 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -823,17 +823,13 @@ tree_mod_log_eb_copy(struct btrfs_fs_info *fs_info, struct extent_buffer *dst,
for (i = 0; i < nr_items; i++) {
tm_list_rem[i] = alloc_tree_mod_elem(src, i + src_offset,
MOD_LOG_KEY_REMOVE, GFP_NOFS);
- if (!tm_list_rem[i]) {
- ret = -ENOMEM;
- goto free_tms;
- }
+ if (!tm_list_rem[i])
+ goto e_nomem;
tm_list_add[i] = alloc_tree_mod_elem(dst, i + dst_offset,
MOD_LOG_KEY_ADD, GFP_NOFS);
- if (!tm_list_add[i]) {
- ret = -ENOMEM;
- goto free_tms;
- }
+ if (!tm_list_add[i])
+ goto e_nomem;
}
if (tree_mod_dont_log(fs_info, NULL))
@@ -854,6 +850,8 @@ tree_mod_log_eb_copy(struct btrfs_fs_info *fs_info, struct extent_buffer *dst,
return 0;
+e_nomem:
+ ret = -ENOMEM;
free_tms:
for (i = 0; i < nr_items * 2; i++) {
if (tm_list[i] && !RB_EMPTY_NODE(&tm_list[i]->node))
--
2.14.0
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 1/5] btrfs: Use common error handling code in tree_mod_log_eb_copy() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-21 14:40 +0200
csiph-web