From patchwork Tue Jan 17 22:31:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 9522035 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E37196020B for ; Tue, 17 Jan 2017 22:39:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D06D728426 for ; Tue, 17 Jan 2017 22:39:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C32A728602; Tue, 17 Jan 2017 22:39:55 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 3B35B28426 for ; Tue, 17 Jan 2017 22:39:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751363AbdAQWjx (ORCPT ); Tue, 17 Jan 2017 17:39:53 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33738 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751353AbdAQWjv (ORCPT ); Tue, 17 Jan 2017 17:39:51 -0500 Received: by mail-wm0-f66.google.com with SMTP id r144so41966062wme.0 for ; Tue, 17 Jan 2017 14:39:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CJ2kEqs7hVpOPzdLdk5pOpPdAggy+IVhW/+9nSwFJNo=; b=cC/gB3FveZqpA0zlwQPhc9EhBIe8hKK+yhpTVB6LsjdVSmef3lN18u7MOhb0sIEqQn O+joNVtakruId0wxo9+dfyW49l72J+RYyIOakTE8cjLVunU7p7ZE2/8j9yZWDUqXnJ/k wNGrqXgn9ZeuZlHQX3RB1U0PbGqRs/Yfvd2uyT599rKue+3Myh1XdYWpSkjz8IeDQ/My wUkfNfqI2tiofhasrVc4yNK51L0i1bSELmOYisiohTgS65dHiTIB96/Tcbsz+5a/QEsp aOkULdy9rMA3o2nVI2GUN52EFHmzseOVEizIOXjwR36ivW2wkOrcqIp/fGd8q8yjKJbc vFeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CJ2kEqs7hVpOPzdLdk5pOpPdAggy+IVhW/+9nSwFJNo=; b=Q10ChVwxvVtyo12s1A047pTiTZON2h54Io7n9odJkhj4uwrf3r5jPnbviUX/aSy7rw q6MLc/HpWP71Kq/AsPVzBiuQV/cqQFoyvQ7BELZl2QlQR9QVZxIm+zhfQNVqPxBhUvRZ o7sRsagV6WoNkoMVOIm/LLpNwlgyBN/u9j2j9yaMcBr5nqoaPmlW8G2r6YmgGsKUCqol BN0joIcH1mu81xDd3rCQhT3mPUTa0UVy1UjIg4Pm5Z4Y2U9v6WZWMzYFft1COnWvDOam ntm4vahGBAF4VyzK48THuLOSVf9jZebGoD46+zi4VQg1RFiL+yHPejAJ7gOOCxORHa0z se8A== X-Gm-Message-State: AIkVDXJnnl7gTEHprpKLCJncguX4D5Y5oroDNX8g4U0f+VL9wjTTRm6kV5pvd0p0mbJ4vg== X-Received: by 10.223.177.134 with SMTP id q6mr11008032wra.83.1484692336607; Tue, 17 Jan 2017 14:32:16 -0800 (PST) Received: from fisk.lan (ivokamhome.ddns.nbis.net. [87.120.136.31]) by smtp.gmail.com with ESMTPSA id w197sm39980489wmd.11.2017.01.17.14.32.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 14:32:16 -0800 (PST) From: Nikolay Borisov To: dsterba@suse.cz Cc: linux-btrfs@vger.kernel.org, Nikolay Borisov Subject: [PATCHv2 10/24] btrfs: Make copy_items take btrfs_inode Date: Wed, 18 Jan 2017 00:31:36 +0200 Message-Id: <1484692310-3987-11-git-send-email-n.borisov.lkml@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484692310-3987-1-git-send-email-n.borisov.lkml@gmail.com> References: <20170117161550.GW12081@twin.jikos.cz> <1484692310-3987-1-git-send-email-n.borisov.lkml@gmail.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 Signed-off-by: Nikolay Borisov --- fs/btrfs/tree-log.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 7669e95be423..12872bf492bd 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -3613,16 +3613,16 @@ static int log_inode_item(struct btrfs_trans_handle *trans, } static noinline int copy_items(struct btrfs_trans_handle *trans, - struct inode *inode, + struct btrfs_inode *inode, struct btrfs_path *dst_path, struct btrfs_path *src_path, u64 *last_extent, int start_slot, int nr, int inode_only, u64 logged_isize) { - struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); + struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb); unsigned long src_offset; unsigned long dst_offset; - struct btrfs_root *log = BTRFS_I(inode)->root->log_root; + struct btrfs_root *log = inode->root->log_root; struct btrfs_file_extent_item *extent; struct btrfs_inode_item *inode_item; struct extent_buffer *src = src_path->nodes[0]; @@ -3633,7 +3633,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, char *ins_data; int i; struct list_head ordered_sums; - int skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM; + int skip_csum = inode->flags & BTRFS_INODE_NODATASUM; bool has_extents = false; bool need_find_last_extent = true; bool done = false; @@ -3675,7 +3675,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, dst_path->slots[0], struct btrfs_inode_item); fill_inode_item(trans, dst_path->nodes[0], inode_item, - inode, inode_only == LOG_INODE_EXISTS, + &inode->vfs_inode, inode_only == LOG_INODE_EXISTS, logged_isize); } else { copy_extent_buffer(dst_path->nodes[0], src, dst_offset, @@ -3783,7 +3783,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, if (need_find_last_extent) { u64 len; - ret = btrfs_prev_leaf(BTRFS_I(inode)->root, src_path); + ret = btrfs_prev_leaf(inode->root, src_path); if (ret < 0) return ret; if (ret) @@ -3792,7 +3792,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, src_path->slots[0]--; src = src_path->nodes[0]; btrfs_item_key_to_cpu(src, &key, src_path->slots[0]); - if (key.objectid != btrfs_ino(BTRFS_I(inode)) || + if (key.objectid != btrfs_ino(inode) || key.type != BTRFS_EXTENT_DATA_KEY) goto fill_holes; extent = btrfs_item_ptr(src, src_path->slots[0], @@ -3825,8 +3825,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, if (need_find_last_extent) { /* btrfs_prev_leaf could return 1 without releasing the path */ btrfs_release_path(src_path); - ret = btrfs_search_slot(NULL, BTRFS_I(inode)->root, &first_key, - src_path, 0, 0); + ret = btrfs_search_slot(NULL, inode->root, &first_key, src_path, 0, 0); if (ret < 0) return ret; ASSERT(ret == 0); @@ -3846,7 +3845,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, u64 extent_end; if (i >= btrfs_header_nritems(src_path->nodes[0])) { - ret = btrfs_next_leaf(BTRFS_I(inode)->root, src_path); + ret = btrfs_next_leaf(inode->root, src_path); if (ret < 0) return ret; ASSERT(ret == 0); @@ -3857,7 +3856,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, btrfs_item_key_to_cpu(src, &key, i); if (!btrfs_comp_cpu_keys(&key, &last_key)) done = true; - if (key.objectid != btrfs_ino(BTRFS_I(inode)) || + if (key.objectid != btrfs_ino(inode) || key.type != BTRFS_EXTENT_DATA_KEY) { i++; continue; @@ -3880,9 +3879,8 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, } offset = *last_extent; len = key.offset - *last_extent; - ret = btrfs_insert_file_extent(trans, log, btrfs_ino(BTRFS_I(inode)), - offset, 0, 0, len, 0, len, 0, - 0, 0); + ret = btrfs_insert_file_extent(trans, log, btrfs_ino(inode), + offset, 0, 0, len, 0, len, 0, 0, 0); if (ret) break; *last_extent = extent_end; @@ -4306,7 +4304,7 @@ static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans, if (ins_nr > 0) { u64 last_extent = 0; - ret = copy_items(trans, inode, dst_path, path, + ret = copy_items(trans, BTRFS_I(inode), dst_path, path, &last_extent, start_slot, ins_nr, 1, 0); /* can't be 1, extent items aren't processed */ @@ -4336,7 +4334,7 @@ static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans, if (ins_nr > 0) { u64 last_extent = 0; - ret = copy_items(trans, inode, dst_path, path, + ret = copy_items(trans, BTRFS_I(inode), dst_path, path, &last_extent, start_slot, ins_nr, 1, 0); /* can't be 1, extent items aren't processed */ @@ -4784,7 +4782,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, ins_nr = 1; ins_start_slot = path->slots[0]; } - ret = copy_items(trans, inode, dst_path, path, + ret = copy_items(trans, BTRFS_I(inode), dst_path, path, &last_extent, ins_start_slot, ins_nr, inode_only, logged_isize); @@ -4837,7 +4835,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, if (min_key.type == BTRFS_XATTR_ITEM_KEY) { if (ins_nr == 0) goto next_slot; - ret = copy_items(trans, inode, dst_path, path, + ret = copy_items(trans, BTRFS_I(inode), dst_path, path, &last_extent, ins_start_slot, ins_nr, inode_only, logged_isize); if (ret < 0) { @@ -4862,7 +4860,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, goto next_slot; } - ret = copy_items(trans, inode, dst_path, path, &last_extent, + ret = copy_items(trans, BTRFS_I(inode), dst_path, path, &last_extent, ins_start_slot, ins_nr, inode_only, logged_isize); if (ret < 0) { @@ -4886,7 +4884,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, goto again; } if (ins_nr) { - ret = copy_items(trans, inode, dst_path, path, + ret = copy_items(trans, BTRFS_I(inode), dst_path, path, &last_extent, ins_start_slot, ins_nr, inode_only, logged_isize); if (ret < 0) { @@ -4908,7 +4906,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, } } if (ins_nr) { - ret = copy_items(trans, inode, dst_path, path, &last_extent, + ret = copy_items(trans, BTRFS_I(inode), dst_path, path, &last_extent, ins_start_slot, ins_nr, inode_only, logged_isize); if (ret < 0) {