linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Btrfs: if else cleanups
@ 2017-06-13 20:56 Timofey Titovets
  2017-06-13 20:56 ` [PATCH v2 1/2] Btrfs: ref_tree_add remove useless compare Timofey Titovets
  2017-06-13 20:56 ` [PATCH v2 2/2] Btrfs: add_all_parents skip compare Timofey Titovets
  0 siblings, 2 replies; 3+ messages in thread
From: Timofey Titovets @ 2017-06-13 20:56 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Timofey Titovets

Both patches just make code more readable

Changes since v1:
  - Drop controversial patches from patchset for now

Timofey Titovets (2):
  Btrfs: ref_tree_add remove useless compare
  Btrfs: add_all_parents skip compare

 fs/btrfs/backref.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--
2.13.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/2] Btrfs: ref_tree_add remove useless compare
  2017-06-13 20:56 [PATCH v2 0/2] Btrfs: if else cleanups Timofey Titovets
@ 2017-06-13 20:56 ` Timofey Titovets
  2017-06-13 20:56 ` [PATCH v2 2/2] Btrfs: add_all_parents skip compare Timofey Titovets
  1 sibling, 0 replies; 3+ messages in thread
From: Timofey Titovets @ 2017-06-13 20:56 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Timofey Titovets

Remove useless compare to make it more readable

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
---
 fs/btrfs/backref.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 24865da63..0005b8851 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -290,7 +290,7 @@ static int ref_tree_add(struct ref_root *ref_tree, u64 root_id, u64 object_id,

 	if (node->ref_mod > 0)
 		ref_tree->unique_refs += origin_count > 0 ? 0 : 1;
-	else if (node->ref_mod <= 0)
+	else
 		ref_tree->unique_refs += origin_count > 0 ? -1 : 0;

 	if (!node->ref_mod)
--
2.13.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] Btrfs: add_all_parents skip compare
  2017-06-13 20:56 [PATCH v2 0/2] Btrfs: if else cleanups Timofey Titovets
  2017-06-13 20:56 ` [PATCH v2 1/2] Btrfs: ref_tree_add remove useless compare Timofey Titovets
@ 2017-06-13 20:56 ` Timofey Titovets
  1 sibling, 0 replies; 3+ messages in thread
From: Timofey Titovets @ 2017-06-13 20:56 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Timofey Titovets

Simplify code to make it more readable

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
---
 fs/btrfs/backref.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 0005b8851..2081a8de7 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -588,10 +588,10 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
 			ret = btrfs_next_old_item(root, path, time_seq);
 	}

-	if (ret > 0)
-		ret = 0;
-	else if (ret < 0)
+	if (ret < 0)
 		free_inode_elem_list(eie);
+	else
+		ret = 0;
 	return ret;
 }

--
2.13.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-13 20:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-13 20:56 [PATCH v2 0/2] Btrfs: if else cleanups Timofey Titovets
2017-06-13 20:56 ` [PATCH v2 1/2] Btrfs: ref_tree_add remove useless compare Timofey Titovets
2017-06-13 20:56 ` [PATCH v2 2/2] Btrfs: add_all_parents skip compare Timofey Titovets

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).