linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Edmund Nadolski <enadolski@suse.com>
To: enadolski@suse.com, linux-btrfs@vger.kernel.org
Subject: [PATCH 3/3] btrfs: remove dead code from btrfs_get_extent
Date: Mon, 20 Nov 2017 13:24:49 -0700	[thread overview]
Message-ID: <20171120202449.22947-4-enadolski@suse.com> (raw)
In-Reply-To: <20171120202449.22947-1-enadolski@suse.com>

Due to new_inline logic, the create == 0 is always true at this
point in the code, so the create != 0 branch can be removed.

Signed-off-by: Edmund Nadolski <enadolski@suse.com>
---
 fs/btrfs/inode.c | 22 +---------------------
 1 file changed, 1 insertion(+), 21 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index b6d5d94..0d4a066 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6957,7 +6957,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
 	struct btrfs_trans_handle *trans = NULL;
 	const bool new_inline = !page || create;
 
-again:
 	read_lock(&em_tree->lock);
 	em = lookup_extent_mapping(em_tree, start, len);
 	if (em)
@@ -7098,7 +7097,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
 		em->orig_block_len = em->len;
 		em->orig_start = em->start;
 		ptr = btrfs_file_extent_inline_start(item) + extent_offset;
-		if (create == 0 && !PageUptodate(page)) {
+		if (!PageUptodate(page)) {
 			if (btrfs_file_extent_compression(leaf, item) !=
 			    BTRFS_COMPRESS_NONE) {
 				ret = uncompress_inline(path, page, pg_offset,
@@ -7119,25 +7118,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
 				kunmap(page);
 			}
 			flush_dcache_page(page);
-		} else if (create && PageUptodate(page)) {
-			BUG();
-			if (!trans) {
-				kunmap(page);
-				free_extent_map(em);
-				em = NULL;
-
-				btrfs_release_path(path);
-				trans = btrfs_join_transaction(root);
-
-				if (IS_ERR(trans))
-					return ERR_CAST(trans);
-				goto again;
-			}
-			map = kmap(page);
-			write_extent_buffer(leaf, map + pg_offset, ptr,
-					    copy_size);
-			kunmap(page);
-			btrfs_mark_buffer_dirty(leaf);
 		}
 		set_extent_uptodate(io_tree, em->start,
 				    extent_map_end(em) - 1, NULL, GFP_NOFS);
-- 
2.10.2


  parent reply	other threads:[~2017-11-20 20:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-20 20:24 [PATCH 0/3] btrfs: some code cleanup and documentation Edmund Nadolski
2017-11-20 20:24 ` [PATCH 1/3] btrfs: btrfs_inode_log_parent should use defined inode_only values Edmund Nadolski
2017-11-21  8:44   ` Nikolay Borisov
2017-11-20 20:24 ` [PATCH 2/3] btrfs: update some code documentation Edmund Nadolski
2017-11-21  7:59   ` Nikolay Borisov
2017-11-21 22:20     ` Edmund Nadolski
2017-11-22  7:01       ` Nikolay Borisov
2017-11-21 13:24   ` David Sterba
2017-11-20 20:24 ` Edmund Nadolski [this message]
2017-11-21  8:25   ` [PATCH 3/3] btrfs: remove dead code from btrfs_get_extent Nikolay Borisov
2017-11-21 13:28 ` [PATCH 0/3] btrfs: some code cleanup and documentation David Sterba

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=20171120202449.22947-4-enadolski@suse.com \
    --to=enadolski@suse.com \
    --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 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).