All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: dsterba@suse.cz
Cc: linux-btrfs@vger.kernel.org, Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH] btrfs: Remove dead code btrfs_get_extent
Date: Tue,  5 Dec 2017 13:53:25 +0200	[thread overview]
Message-ID: <1512474805-30223-1-git-send-email-nborisov@suse.com> (raw)
In-Reply-To: <20171204134521.GV3553@twin.jikos.cz>

trans was statically assigned to NULL and this never changes over the course of
btrfs_get_extent. This was added in commit a52d9a8033c4 ("Btrfs: Extent based
page cache code.  This uses an rbtree of extents and tests instead of buffer
heads.") and wasn't used even then, which indicates it was never intended to be
merged. So remove any code which checks whether trans != NULL and
just hardcode the fact trans is always NULL. This fixes CID#112806

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/inode.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 57785eadb95c..92d140b06271 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6943,7 +6943,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
 	struct extent_map *em = NULL;
 	struct extent_map_tree *em_tree = &inode->extent_tree;
 	struct extent_io_tree *io_tree = &inode->io_tree;
-	struct btrfs_trans_handle *trans = NULL;
 	const bool new_inline = !page || create;
 
 	read_lock(&em_tree->lock);
@@ -6984,8 +6983,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
 		path->reada = READA_FORWARD;
 	}
 
-	ret = btrfs_lookup_file_extent(trans, root, path,
-				       objectid, start, trans != NULL);
+	ret = btrfs_lookup_file_extent(NULL, root, path, objectid, start, 0);
 	if (ret < 0) {
 		err = ret;
 		goto out;
@@ -7181,11 +7179,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
 	trace_btrfs_get_extent(root, inode, em);
 
 	btrfs_free_path(path);
-	if (trans) {
-		ret = btrfs_end_transaction(trans);
-		if (!err)
-			err = ret;
-	}
 	if (err) {
 		free_extent_map(em);
 		return ERR_PTR(err);
-- 
2.7.4


  reply	other threads:[~2017-12-05 11:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-01  9:19 [PATCH 0/5] Misc cleanups Nikolay Borisov
2017-12-01  9:19 ` [PATCH 1/5] btrfs: Remove dead code Nikolay Borisov
2017-12-04 13:45   ` David Sterba
2017-12-05 11:53     ` Nikolay Borisov [this message]
2017-12-01  9:19 ` [PATCH 2/5] " Nikolay Borisov
2017-12-04 13:50   ` David Sterba
2017-12-04 16:17     ` Nikolay Borisov
2017-12-01  9:19 ` [PATCH 3/5] btrfs: Fix possible off-by-one in btrfs_search_path_in_tree Nikolay Borisov
2017-12-06 15:48   ` David Sterba
2017-12-01  9:19 ` [PATCH 4/5] btrfs: Remove redundant NULL check Nikolay Borisov
2017-12-06 16:02   ` David Sterba
2017-12-01  9:19 ` [PATCH 5/5] btrfs: Greatly simplify btrfs_read_dev_super Nikolay Borisov
2017-12-01 23:23   ` Anand Jain
2017-12-03  9:43     ` Nikolay Borisov
2017-12-04  1:33       ` Anand Jain
2017-12-04 14:13       ` David Sterba
2017-12-04 16:20         ` Nikolay Borisov
2017-12-06 16:24           ` David Sterba
     [not found]             ` <24281483-900c-ab1b-c407-5fa6983f5311@oracle.com>
2017-12-08  8:13               ` Anand Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1512474805-30223-1-git-send-email-nborisov@suse.com \
    --to=nborisov@suse.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.