From patchwork Fri Feb 17 14:43:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 9580015 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 BDC18600F6 for ; Fri, 17 Feb 2017 14:45:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADFEA286F4 for ; Fri, 17 Feb 2017 14:45:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A31D9286F6; Fri, 17 Feb 2017 14:45:16 +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 4B787286F4 for ; Fri, 17 Feb 2017 14:45:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934455AbdBQOpO (ORCPT ); Fri, 17 Feb 2017 09:45:14 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33369 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934506AbdBQOoF (ORCPT ); Fri, 17 Feb 2017 09:44:05 -0500 Received: by mail-wm0-f67.google.com with SMTP id v77so2936449wmv.0 for ; Fri, 17 Feb 2017 06:44:04 -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=r8IjmFFvnpZGuwtL7lgTi7E4bA7+VOHwaG9YsMLh+u8=; b=fdjTm7+xNm1PBJDFHagACoYa8oNvZrvnkUN6wY0ou+oGscdsKQWX68kwdb/b/ds1p0 G9ZjwNLfBuJK6R1JLjqHKpU0RE6yMY+QlrVp0hlLIWKrezgZQUWZAd3sJaZhI8Q/kd4b xhPca3J2BQBXK08s/kpRyLPlBAlcNIYmEZtZFqUYMIaw1rzZzt+PWYiv0fZ1K6fJmmKE 7Fy+3IQbNfEfRc+YKtVhiCYnNBz01vaAWlYiEUapl9j9yWjidOkAsiK72aZp29PLQgyQ EDy1mH2XdDRTtXp1hJNWMFvR2B9/Mgq1j50nR+Tmx+opNL6T/xl8qX51X5r/PxFyP8wQ /aMg== 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=r8IjmFFvnpZGuwtL7lgTi7E4bA7+VOHwaG9YsMLh+u8=; b=JR/rpw3f9KiO2h3/B+jDrTZbzbAKMrRkRzHx1fiyBxpmUovh4W0uPxsZcjJkJKXviW PYRT0EDdBkvYtaqwDUVyDz7aWtdR7LRico+QoVMaPtgsSD4ZfEmasamfquy9xiP0IK0+ mjcyGT6dKazR6caJvMIutpKvdRuMt340EpadrD7/MS9YXMAoj3rTDTVzBKtCq34PppDn lN0kh3IxJtGAwRAlJyk6rW0wCSrubn4S4eUOYBOWoPbZHImyqVrNjPNuCZNvg0pTQTtQ xwEkI2T+UpsjaCQQ0HMNuvlnNtCGxj475cq0bOHh8e0Ozd5eOY/pTFoufHEc2JIZqo+M TujA== X-Gm-Message-State: AMke39lvPDgzgufcfgVUEc4IHlhl1Dh4xxDlHScD9kMvs+r+72UN9AOSMhXVAQe1MI/LDw== X-Received: by 10.28.137.203 with SMTP id l194mr3953241wmd.63.1487342644269; Fri, 17 Feb 2017 06:44:04 -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.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Feb 2017 06:44:03 -0800 (PST) From: Nikolay Borisov X-Google-Original-From: Nikolay Borisov To: dsterba@suse.com Cc: linux-btrfs@vger.kernel.org, Nikolay Borisov , Nikolay Borisov Subject: [PATCH 17/38] btrfs: Make hole_mergeable take btrfs_inode Date: Fri, 17 Feb 2017 16:43:08 +0200 Message-Id: <1487342609-20652-18-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 From: Nikolay Borisov Signed-off-by: Nikolay Borisov --- fs/btrfs/file.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 37458605847a..53fedf3dcaef 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -2193,7 +2193,7 @@ static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma) return 0; } -static int hole_mergeable(struct inode *inode, struct extent_buffer *leaf, +static int hole_mergeable(struct btrfs_inode *inode, struct extent_buffer *leaf, int slot, u64 start, u64 end) { struct btrfs_file_extent_item *fi; @@ -2203,7 +2203,7 @@ static int hole_mergeable(struct inode *inode, struct extent_buffer *leaf, return 0; btrfs_item_key_to_cpu(leaf, &key, slot); - if (key.objectid != btrfs_ino(BTRFS_I(inode)) || + if (key.objectid != btrfs_ino(inode) || key.type != BTRFS_EXTENT_DATA_KEY) return 0; @@ -2253,7 +2253,7 @@ static int fill_holes(struct btrfs_trans_handle *trans, struct inode *inode, } leaf = path->nodes[0]; - if (hole_mergeable(inode, leaf, path->slots[0]-1, offset, end)) { + if (hole_mergeable(BTRFS_I(inode), leaf, path->slots[0]-1, offset, end)) { u64 num_bytes; path->slots[0]--; @@ -2268,7 +2268,7 @@ static int fill_holes(struct btrfs_trans_handle *trans, struct inode *inode, goto out; } - if (hole_mergeable(inode, leaf, path->slots[0], offset, end)) { + if (hole_mergeable(BTRFS_I(inode), leaf, path->slots[0], offset, end)) { u64 num_bytes; key.offset = offset;