From patchwork Sun Jan 12 13:38:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 3472221 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A34999F2E9 for ; Sun, 12 Jan 2014 13:39:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E2D0720103 for ; Sun, 12 Jan 2014 13:39:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE39520123 for ; Sun, 12 Jan 2014 13:39:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751177AbaALNjK (ORCPT ); Sun, 12 Jan 2014 08:39:10 -0500 Received: from mail-pd0-f178.google.com ([209.85.192.178]:58257 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751019AbaALNiq (ORCPT ); Sun, 12 Jan 2014 08:38:46 -0500 Received: by mail-pd0-f178.google.com with SMTP id y10so6395845pdj.37 for ; Sun, 12 Jan 2014 05:38:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=427PXRSICMYdoGhPSvaMLfi1gqpH+mo5jB3Dc2SHSmw=; b=nVnp7PRO84LuJrIjyn6uxy5lRTN/UAm2QiTObpaL0IBjjK4q6J0pkcT3TFNhdCp/cO f0IJOTAeCRGPyO4JM0lqkWp4GM77j4PTEFliUmtuJ5EAPnHKU8BFHhnipWIVVh0OMYQD xDqPhud3W5cQMkSqupo85e0IWCOy+f9+FRBXtDHFCF4Zachvd2Obid77sqCK1CrEcsZI 5Zn+Cca7hdVF+RcQn1n53P8tEGAtAo2SbGxss0/9kmwN30gf9Pz/jophZmnIgEYdThpB jYHc5m+UbvqCwLBBXEbRwfqaq+H7C+9Qf4WULskBZyLjLL9TZoyLlpHuqiXQDWmbQP5w YlpA== X-Received: by 10.66.217.166 with SMTP id oz6mr23953574pac.22.1389533926430; Sun, 12 Jan 2014 05:38:46 -0800 (PST) Received: from linux-b0ol.localdomain ([223.65.51.231]) by mx.google.com with ESMTPSA id jn12sm30944540pbd.37.2014.01.12.05.38.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Jan 2014 05:38:45 -0800 (PST) From: Wang Shilong To: linux-btrfs@vger.kernel.org Subject: [PATCH 3/3] Btrfs: fix missing inline refs when walking backrefs Date: Sun, 12 Jan 2014 21:38:34 +0800 Message-Id: <1389533914-2272-4-git-send-email-wangshilong1991@gmail.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1389533914-2272-1-git-send-email-wangshilong1991@gmail.com> References: <1389533914-2272-1-git-send-email-wangshilong1991@gmail.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wang Shilong If @slot=0, we may have an expected item in the previous leaf, So we should handle that case, otherwise, we will miss inline refs ,fix it. Signed-off-by: Wang Shilong --- fs/btrfs/backref.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 964679c..4ccd726 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -893,14 +893,13 @@ again: spin_unlock(&delayed_refs->lock); } - if (path->slots[0]) { - struct extent_buffer *leaf; - int slot; + ret = btrfs_previous_extent_item(fs_info->extent_root, path, + key.objectid); + if (ret < 0) + goto out; - path->slots[0]--; - leaf = path->nodes[0]; - slot = path->slots[0]; - btrfs_item_key_to_cpu(leaf, &key, slot); + if (ret == 0) { + btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); if (key.objectid == bytenr && (key.type == BTRFS_EXTENT_ITEM_KEY || key.type == BTRFS_METADATA_ITEM_KEY)) {