From patchwork Fri Feb 17 14:43:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 9579983 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 4D946600F6 for ; Fri, 17 Feb 2017 14:44:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DEF6286F3 for ; Fri, 17 Feb 2017 14:44:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33089286F7; Fri, 17 Feb 2017 14:44:30 +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 ABC70286F3 for ; Fri, 17 Feb 2017 14:44:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934572AbdBQOo1 (ORCPT ); Fri, 17 Feb 2017 09:44:27 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:33871 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934552AbdBQOoW (ORCPT ); Fri, 17 Feb 2017 09:44:22 -0500 Received: by mail-wr0-f194.google.com with SMTP id c4so5517532wrd.1 for ; Fri, 17 Feb 2017 06:44:22 -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=WwfB1NG0Lg99WzEph2eSBRIhXu0Zg0Mx0ieIs7tFI78=; b=dgXxXWJv2r8uKn+n9esFmIEJSNC3XdMZNFMPy4jlKYh/oQii51oTjdecDTs951zhx7 kD0NxpOf3ltD3nXfLKP905ZkC2GZJf7TrsJ+vSECKO3czKV/kXOYcM+0eHzUqqBDbaQy I5mOyjw4w9GOtJkBQaRfbai52VzdLUA75pSSFFe4gpQ7yTQAXd6X/8gL7F8wVWeWHPar jAb/EwjlcUaCUASEsS5/JK4rtCOZLL2/i9MFUBgGGCo/Ogss4oKLjBJUq2P//Q43elX6 WbWNTP6pQ+EtN0gCwE8UWagFI/nrzurIumd2hN3s7FT5CPdfmbqiyldhVWj63VGYAtPU 01mw== 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=WwfB1NG0Lg99WzEph2eSBRIhXu0Zg0Mx0ieIs7tFI78=; b=ncUnWDzlSlpTe9qfpFib1fiQWSbt8HYievnZOpek7T012yfEArX+th5OYRaGvQt/5I hve4+GINhfG/bXykygIUNLS2i/H7Zd22WPsN6pgH9Ri3Xnqr+gbyOOoVW/zcEZvK9Tz2 OLufmfcnzhPNyvGqVQrk++BwRofgTjtr8BCaK+F63FmysCPl8LYuUBET83Klo+JXdeng EC/GZS00iRbvAXBrvcb3xtM54zfkDIapZJCDjGlAOwDi6mjjJsNprjqRJqbwLa08jK6F vuygSBJPwhcSkpzhBov/MuW0ZJ1+1GaxMMqsnvz0Yxok4ZjhFALVjKj11mY1bxX2LMnm zYfQ== X-Gm-Message-State: AMke39mAi2x8f6/yCL/1ceaEErCro+PDNRSUa4GG7OkvJo7uH0kHt2Si7TcZ1MVqvppl7w== X-Received: by 10.223.134.15 with SMTP id 15mr7617102wrv.102.1487342661474; Fri, 17 Feb 2017 06:44:21 -0800 (PST) Received: from fisk.suse.de (ivokamhome.ddns.nbis.net. [87.120.136.31]) by smtp.gmail.com with ESMTPSA id y126sm1932713wmg.19.2017.02.17.06.44.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Feb 2017 06:44:21 -0800 (PST) From: Nikolay Borisov X-Google-Original-From: Nikolay Borisov To: dsterba@suse.com Cc: linux-btrfs@vger.kernel.org, Nikolay Borisov Subject: [PATCH 35/38] btrfs: Make clone_update_extent_map take btrfs_inode Date: Fri, 17 Feb 2017 16:43:26 +0200 Message-Id: <1487342609-20652-36-git-send-email-nborisov@suse.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487342609-20652-1-git-send-email-nborisov@suse.com> References: <1487342609-20652-1-git-send-email-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 Signed-off-by: Nikolay Borisov --- fs/btrfs/ioctl.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index f907853e1c47..cdbf30e5743b 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -3301,20 +3301,19 @@ static int clone_finish_inode_update(struct btrfs_trans_handle *trans, return ret; } -static void clone_update_extent_map(struct inode *inode, +static void clone_update_extent_map(struct btrfs_inode *inode, const struct btrfs_trans_handle *trans, const struct btrfs_path *path, const u64 hole_offset, const u64 hole_len) { - struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; + struct extent_map_tree *em_tree = &inode->extent_tree; struct extent_map *em; int ret; em = alloc_extent_map(); if (!em) { - set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, - &BTRFS_I(inode)->runtime_flags); + set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags); return; } @@ -3323,12 +3322,11 @@ static void clone_update_extent_map(struct inode *inode, fi = btrfs_item_ptr(path->nodes[0], path->slots[0], struct btrfs_file_extent_item); - btrfs_extent_item_to_extent_map(BTRFS_I(inode), path, fi, false, em); + btrfs_extent_item_to_extent_map(inode, path, fi, false, em); em->generation = -1; if (btrfs_file_extent_type(path->nodes[0], fi) == BTRFS_FILE_EXTENT_INLINE) - set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, - &BTRFS_I(inode)->runtime_flags); + set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags); } else { em->start = hole_offset; em->len = hole_len; @@ -3349,13 +3347,12 @@ static void clone_update_extent_map(struct inode *inode, free_extent_map(em); break; } - btrfs_drop_extent_cache(BTRFS_I(inode), em->start, + btrfs_drop_extent_cache(inode, em->start, em->start + em->len - 1, 0); } if (ret) - set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, - &BTRFS_I(inode)->runtime_flags); + set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags); } /* @@ -3781,11 +3778,11 @@ static int btrfs_clone(struct inode *src, struct inode *inode, /* If we have an implicit hole (NO_HOLES feature). */ if (drop_start < new_key.offset) - clone_update_extent_map(inode, trans, + clone_update_extent_map(BTRFS_I(inode), trans, NULL, drop_start, new_key.offset - drop_start); - clone_update_extent_map(inode, trans, path, 0, 0); + clone_update_extent_map(BTRFS_I(inode), trans, path, 0, 0); btrfs_mark_buffer_dirty(leaf); btrfs_release_path(path); @@ -3835,7 +3832,7 @@ static int btrfs_clone(struct inode *src, struct inode *inode, btrfs_end_transaction(trans); goto out; } - clone_update_extent_map(inode, trans, NULL, last_dest_end, + clone_update_extent_map(BTRFS_I(inode), trans, NULL, last_dest_end, destoff + len - last_dest_end); ret = clone_finish_inode_update(trans, inode, destoff + len, destoff, olen, no_time_update);