From patchwork Wed Jun 19 14:04:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 11004251 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6552614E5 for ; Wed, 19 Jun 2019 14:04:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54A0128A8E for ; Wed, 19 Jun 2019 14:04:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4870D28AB1; Wed, 19 Jun 2019 14:04:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03ED628A8E for ; Wed, 19 Jun 2019 14:04:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730249AbfFSOEo (ORCPT ); Wed, 19 Jun 2019 10:04:44 -0400 Received: from mx2.suse.de ([195.135.220.15]:42874 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729304AbfFSOEn (ORCPT ); Wed, 19 Jun 2019 10:04:43 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id AF17BAD05 for ; Wed, 19 Jun 2019 14:04:42 +0000 (UTC) From: Nikolay Borisov To: linux-btrfs@vger.kernel.org Cc: Nikolay Borisov Subject: [PATCH 1/4] btrfs-progs: Remove redundant if Date: Wed, 19 Jun 2019 17:04:37 +0300 Message-Id: <20190619140440.5550-2-nborisov@suse.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619140440.5550-1-nborisov@suse.com> References: <20190619140440.5550-1-nborisov@suse.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 'pin' is always true in __free_extent so there is no point in checking it. Just remove the if and unindent the code. Signed-off-by: Nikolay Borisov --- extent-tree.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/extent-tree.c b/extent-tree.c index c6516b2ba445..7693313c50b3 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -2074,7 +2074,6 @@ static int __free_extent(struct btrfs_trans_handle *trans, } } else { int mark_free = 0; - int pin = 1; if (found_extent) { BUG_ON(is_data && refs_to_drop != @@ -2088,13 +2087,11 @@ static int __free_extent(struct btrfs_trans_handle *trans, } } - if (pin) { - ret = pin_down_bytes(trans, bytenr, num_bytes, - is_data); - if (ret > 0) - mark_free = 1; - BUG_ON(ret < 0); - } + ret = pin_down_bytes(trans, bytenr, num_bytes, + is_data); + if (ret > 0) + mark_free = 1; + BUG_ON(ret < 0); ret = btrfs_del_items(trans, extent_root, path, path->slots[0], num_to_del); From patchwork Wed Jun 19 14:04:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 11004253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 92087112C for ; Wed, 19 Jun 2019 14:04:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 812E128A96 for ; Wed, 19 Jun 2019 14:04:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7557428A97; Wed, 19 Jun 2019 14:04:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D583628AA0 for ; Wed, 19 Jun 2019 14:04:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730389AbfFSOEr (ORCPT ); Wed, 19 Jun 2019 10:04:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:42880 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729325AbfFSOEo (ORCPT ); Wed, 19 Jun 2019 10:04:44 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 05A13AD33 for ; Wed, 19 Jun 2019 14:04:43 +0000 (UTC) From: Nikolay Borisov To: linux-btrfs@vger.kernel.org Cc: Nikolay Borisov Subject: [PATCH 2/4] btrfs-progs: Remove commented code Date: Wed, 19 Jun 2019 17:04:38 +0300 Message-Id: <20190619140440.5550-3-nborisov@suse.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619140440.5550-1-nborisov@suse.com> References: <20190619140440.5550-1-nborisov@suse.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This piece of code has been commented since 2009, given the number of changes that have happened it's unlikely it could be made to work or is needed at all. Just delete it. Signed-off-by: Nikolay Borisov --- extent-tree.c | 257 -------------------------------------------------- 1 file changed, 257 deletions(-) diff --git a/extent-tree.c b/extent-tree.c index 7693313c50b3..b822eaa28700 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -2539,263 +2539,6 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, return buf; } -#if 0 - -static int noinline drop_leaf_ref(struct btrfs_trans_handle *trans, - struct btrfs_root *root, - struct extent_buffer *leaf) -{ - u64 leaf_owner; - u64 leaf_generation; - struct btrfs_key key; - struct btrfs_file_extent_item *fi; - int i; - int nritems; - int ret; - - BUG_ON(!btrfs_is_leaf(leaf)); - nritems = btrfs_header_nritems(leaf); - leaf_owner = btrfs_header_owner(leaf); - leaf_generation = btrfs_header_generation(leaf); - - for (i = 0; i < nritems; i++) { - u64 disk_bytenr; - - btrfs_item_key_to_cpu(leaf, &key, i); - if (btrfs_key_type(&key) != BTRFS_EXTENT_DATA_KEY) - continue; - fi = btrfs_item_ptr(leaf, i, struct btrfs_file_extent_item); - if (btrfs_file_extent_type(leaf, fi) == - BTRFS_FILE_EXTENT_INLINE) - continue; - /* - * FIXME make sure to insert a trans record that - * repeats the snapshot del on crash - */ - disk_bytenr = btrfs_file_extent_disk_bytenr(leaf, fi); - if (disk_bytenr == 0) - continue; - ret = btrfs_free_extent(trans, root, disk_bytenr, - btrfs_file_extent_disk_num_bytes(leaf, fi), - leaf->start, leaf_owner, leaf_generation, - key.objectid, 0); - BUG_ON(ret); - } - return 0; -} - -static void noinline reada_walk_down(struct btrfs_root *root, - struct extent_buffer *node, - int slot) -{ - u64 bytenr; - u64 last = 0; - u32 nritems; - u32 refs; - u32 blocksize; - int ret; - int i; - int level; - int skipped = 0; - - nritems = btrfs_header_nritems(node); - level = btrfs_header_level(node); - if (level) - return; - - for (i = slot; i < nritems && skipped < 32; i++) { - bytenr = btrfs_node_blockptr(node, i); - if (last && ((bytenr > last && bytenr - last > SZ_32K) || - (last > bytenr && last - bytenr > SZ_32K))) { - skipped++; - continue; - } - blocksize = btrfs_level_size(root, level - 1); - if (i != slot) { - ret = btrfs_lookup_extent_ref(NULL, root, bytenr, - blocksize, &refs); - BUG_ON(ret); - if (refs != 1) { - skipped++; - continue; - } - } - mutex_unlock(&root->fs_info->fs_mutex); - ret = readahead_tree_block(root, bytenr, blocksize, - btrfs_node_ptr_generation(node, i)); - last = bytenr + blocksize; - cond_resched(); - mutex_lock(&root->fs_info->fs_mutex); - if (ret) - break; - } -} - -/* - * helper function for drop_snapshot, this walks down the tree dropping ref - * counts as it goes. - */ -static int noinline walk_down_tree(struct btrfs_trans_handle *trans, - struct btrfs_root *root, - struct btrfs_path *path, int *level) -{ - u64 root_owner; - u64 root_gen; - u64 bytenr; - u64 ptr_gen; - struct extent_buffer *next; - struct extent_buffer *cur; - struct extent_buffer *parent; - u32 blocksize; - int ret; - u32 refs; - - WARN_ON(*level < 0); - WARN_ON(*level >= BTRFS_MAX_LEVEL); - ret = btrfs_lookup_extent_ref(trans, root, - path->nodes[*level]->start, - path->nodes[*level]->len, &refs); - BUG_ON(ret); - if (refs > 1) - goto out; - - /* - * walk down to the last node level and free all the leaves - */ - while(*level >= 0) { - WARN_ON(*level < 0); - WARN_ON(*level >= BTRFS_MAX_LEVEL); - cur = path->nodes[*level]; - - if (btrfs_header_level(cur) != *level) - WARN_ON(1); - - if (path->slots[*level] >= - btrfs_header_nritems(cur)) - break; - if (*level == 0) { - ret = drop_leaf_ref(trans, root, cur); - BUG_ON(ret); - break; - } - bytenr = btrfs_node_blockptr(cur, path->slots[*level]); - ptr_gen = btrfs_node_ptr_generation(cur, path->slots[*level]); - blocksize = btrfs_level_size(root, *level - 1); - ret = btrfs_lookup_extent_ref(trans, root, bytenr, blocksize, - &refs); - BUG_ON(ret); - if (refs != 1) { - parent = path->nodes[*level]; - root_owner = btrfs_header_owner(parent); - root_gen = btrfs_header_generation(parent); - path->slots[*level]++; - ret = btrfs_free_extent(trans, root, bytenr, blocksize, - parent->start, root_owner, - root_gen, *level - 1, 0); - BUG_ON(ret); - continue; - } - next = btrfs_find_tree_block(root, bytenr, blocksize); - if (!next || !btrfs_buffer_uptodate(next, ptr_gen)) { - free_extent_buffer(next); - reada_walk_down(root, cur, path->slots[*level]); - mutex_unlock(&root->fs_info->fs_mutex); - next = read_tree_block(root, bytenr, blocksize, - ptr_gen); - mutex_lock(&root->fs_info->fs_mutex); - if (!extent_buffer_uptodate(next)) { - if (IS_ERR(next)) - ret = PTR_ERR(next); - else - ret = -EIO; - break; - } - } - WARN_ON(*level <= 0); - if (path->nodes[*level-1]) - free_extent_buffer(path->nodes[*level-1]); - path->nodes[*level-1] = next; - *level = btrfs_header_level(next); - path->slots[*level] = 0; - } -out: - WARN_ON(*level < 0); - WARN_ON(*level >= BTRFS_MAX_LEVEL); - - if (path->nodes[*level] == root->node) { - root_owner = root->root_key.objectid; - parent = path->nodes[*level]; - } else { - parent = path->nodes[*level + 1]; - root_owner = btrfs_header_owner(parent); - } - - root_gen = btrfs_header_generation(parent); - ret = btrfs_free_extent(trans, root, path->nodes[*level]->start, - path->nodes[*level]->len, parent->start, - root_owner, root_gen, *level, 0); - free_extent_buffer(path->nodes[*level]); - path->nodes[*level] = NULL; - *level += 1; - BUG_ON(ret); - return 0; -} - -/* - * helper for dropping snapshots. This walks back up the tree in the path - * to find the first node higher up where we haven't yet gone through - * all the slots - */ -static int noinline walk_up_tree(struct btrfs_trans_handle *trans, - struct btrfs_root *root, - struct btrfs_path *path, int *level) -{ - u64 root_owner; - u64 root_gen; - struct btrfs_root_item *root_item = &root->root_item; - int i; - int slot; - int ret; - - for(i = *level; i < BTRFS_MAX_LEVEL - 1 && path->nodes[i]; i++) { - slot = path->slots[i]; - if (slot < btrfs_header_nritems(path->nodes[i]) - 1) { - struct extent_buffer *node; - struct btrfs_disk_key disk_key; - node = path->nodes[i]; - path->slots[i]++; - *level = i; - WARN_ON(*level == 0); - btrfs_node_key(node, &disk_key, path->slots[i]); - memcpy(&root_item->drop_progress, - &disk_key, sizeof(disk_key)); - root_item->drop_level = i; - return 0; - } else { - struct extent_buffer *parent; - if (path->nodes[*level] == root->node) - parent = path->nodes[*level]; - else - parent = path->nodes[*level + 1]; - - root_owner = btrfs_header_owner(parent); - root_gen = btrfs_header_generation(parent); - ret = btrfs_free_extent(trans, root, - path->nodes[*level]->start, - path->nodes[*level]->len, - parent->start, root_owner, - root_gen, *level, 0); - BUG_ON(ret); - free_extent_buffer(path->nodes[*level]); - path->nodes[*level] = NULL; - *level = i + 1; - } - } - return 1; -} - -#endif - int btrfs_free_block_groups(struct btrfs_fs_info *info) { struct btrfs_space_info *sinfo; From patchwork Wed Jun 19 14:04:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 11004255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A155112C for ; Wed, 19 Jun 2019 14:04:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89403201B1 for ; Wed, 19 Jun 2019 14:04:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DE2428AA0; Wed, 19 Jun 2019 14:04:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26C0228A97 for ; Wed, 19 Jun 2019 14:04:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730429AbfFSOEs (ORCPT ); Wed, 19 Jun 2019 10:04:48 -0400 Received: from mx2.suse.de ([195.135.220.15]:42886 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729463AbfFSOEo (ORCPT ); Wed, 19 Jun 2019 10:04:44 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 4F48BAD7C for ; Wed, 19 Jun 2019 14:04:43 +0000 (UTC) From: Nikolay Borisov To: linux-btrfs@vger.kernel.org Cc: Nikolay Borisov Subject: [PATCH 3/4] btrfs: Remove old send implementation Date: Wed, 19 Jun 2019 17:04:39 +0300 Message-Id: <20190619140440.5550-4-nborisov@suse.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619140440.5550-1-nborisov@suse.com> References: <20190619140440.5550-1-nborisov@suse.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit ba23855cdc89 ("btrfs-progs: send: use splice syscall instead of read/write to transfer buffer") changed the send implementation to use splice(). The old read/write implementation hasn't be used for at least 3 years, it's time to remove it. Signed-off-by: Nikolay Borisov --- cmds-send.c | 61 ----------------------------------------------------- 1 file changed, 61 deletions(-) diff --git a/cmds-send.c b/cmds-send.c index 6496d8e39bbf..1735c35dca74 100644 --- a/cmds-send.c +++ b/cmds-send.c @@ -207,67 +207,6 @@ static int add_clone_source(struct btrfs_send *sctx, u64 root_id) return 0; } -#if 0 -static int write_buf(int fd, const char *buf, size_t size) -{ - int ret; - size_t pos = 0; - - while (pos < size) { - ssize_t wbytes; - - wbytes = write(fd, buf + pos, size - pos); - if (wbytes < 0) { - ret = -errno; - error("failed to dump stream: %s", strerror(-ret)); - goto out; - } - if (!wbytes) { - ret = -EIO; - error("failed to dump stream: %s", strerror(-ret)); - goto out; - } - pos += wbytes; - } - ret = 0; - -out: - return ret; -} - -static void* read_sent_data_copy(void *arg) -{ - int ret; - struct btrfs_send *sctx = (struct btrfs_send*)arg; - char buf[SEND_BUFFER_SIZE]; - - while (1) { - ssize_t rbytes; - - rbytes = read(sctx->send_fd, buf, sizeof(buf)); - if (rbytes < 0) { - ret = -errno; - error("failed to read stream from kernel: %s", - strerror(-ret)); - goto out; - } - if (!rbytes) { - ret = 0; - goto out; - } - ret = write_buf(sctx->dump_fd, buf, rbytes); - if (ret < 0) - goto out; - } - -out: - if (ret < 0) - exit(-ret); - - return ERR_PTR(ret); -} -#endif - static void *read_sent_data(void *arg) { int ret; From patchwork Wed Jun 19 14:04:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 11004249 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E214314DB for ; Wed, 19 Jun 2019 14:04:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D16E228A8E for ; Wed, 19 Jun 2019 14:04:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5BA228AA7; Wed, 19 Jun 2019 14:04:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F85328AA4 for ; Wed, 19 Jun 2019 14:04:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730301AbfFSOEp (ORCPT ); Wed, 19 Jun 2019 10:04:45 -0400 Received: from mx2.suse.de ([195.135.220.15]:42892 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730164AbfFSOEo (ORCPT ); Wed, 19 Jun 2019 10:04:44 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 93FF6ADE6 for ; Wed, 19 Jun 2019 14:04:43 +0000 (UTC) From: Nikolay Borisov To: linux-btrfs@vger.kernel.org Cc: Nikolay Borisov Subject: [PATCH 4/4] btrfs-progs: check: Remove duplicated and commented functions Date: Wed, 19 Jun 2019 17:04:40 +0300 Message-Id: <20190619140440.5550-5-nborisov@suse.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619140440.5550-1-nborisov@suse.com> References: <20190619140440.5550-1-nborisov@suse.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 756105181e57 ("btrfs-progs: check: supplement extent backref list with rbtree") changed the backref implementation to use rb tree and also commented the old implementations. It's been almost 2 years since that change and it's unlikely the old version will ever be used, so just remove it. Signed-off-by: Nikolay Borisov --- check/main.c | 69 ---------------------------------------------------- 1 file changed, 69 deletions(-) diff --git a/check/main.c b/check/main.c index 731c21d364d7..05ba9819c58e 100644 --- a/check/main.c +++ b/check/main.c @@ -4385,36 +4385,6 @@ static int check_block(struct btrfs_root *root, return ret; } -#if 0 -static struct tree_backref *find_tree_backref(struct extent_record *rec, - u64 parent, u64 root) -{ - struct list_head *cur = rec->backrefs.next; - struct extent_backref *node; - struct tree_backref *back; - - while (cur != &rec->backrefs) { - node = to_extent_backref(cur); - cur = cur->next; - if (node->is_data) - continue; - back = to_tree_backref(node); - if (parent > 0) { - if (!node->full_backref) - continue; - if (parent == back->parent) - return back; - } else { - if (node->full_backref) - continue; - if (back->root == root) - return back; - } - } - return NULL; -} -#endif - static struct tree_backref *alloc_tree_backref(struct extent_record *rec, u64 parent, u64 root) { @@ -4434,45 +4404,6 @@ static struct tree_backref *alloc_tree_backref(struct extent_record *rec, return ref; } -#if 0 -static struct data_backref *find_data_backref(struct extent_record *rec, - u64 parent, u64 root, - u64 owner, u64 offset, - int found_ref, - u64 disk_bytenr, u64 bytes) -{ - struct list_head *cur = rec->backrefs.next; - struct extent_backref *node; - struct data_backref *back; - - while (cur != &rec->backrefs) { - node = to_extent_backref(cur); - cur = cur->next; - if (!node->is_data) - continue; - back = to_data_backref(node); - if (parent > 0) { - if (!node->full_backref) - continue; - if (parent == back->parent) - return back; - } else { - if (node->full_backref) - continue; - if (back->root == root && back->owner == owner && - back->offset == offset) { - if (found_ref && node->found_ref && - (back->bytes != bytes || - back->disk_bytenr != disk_bytenr)) - continue; - return back; - } - } - } - return NULL; -} -#endif - static struct data_backref *alloc_data_backref(struct extent_record *rec, u64 parent, u64 root, u64 owner, u64 offset,