From patchwork Tue Dec 3 12:11:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Liu X-Patchwork-Id: 296169 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D516E2C009F for ; Tue, 3 Dec 2013 23:09:41 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753822Ab3LCMJl (ORCPT ); Tue, 3 Dec 2013 07:09:41 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:51190 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753614Ab3LCMJk (ORCPT ); Tue, 3 Dec 2013 07:09:40 -0500 Received: by mail-pa0-f46.google.com with SMTP id kl14so2869590pab.19 for ; Tue, 03 Dec 2013 04:09:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GmkNtPeK+enbi8Xg+SXJqtT61f1EbXaI5aK01mGk4KE=; b=zA1iKLCCjxy6NgCLbz9wkWho31pMTAnZtkEyRsYgMKsMYJDZZSLOBavAjqVo6RnzRL QGe7VQLJG0jaU3Ap8hZ/cAKfIS3bGMaVHFnr/LfCXpenaayHT6g4AwrG0WX09anfYhs0 21bzLmK3gHPpwtvSTo+fqMWif5o9WGYfX3/ulFt8YGk2LBGX4x579ebzGzb2rfjTOBeD mcQs3dHVRzMa9e2+Th1PcZxLJVj+QysDwpBUkJ/d99AmUcyd2yl42oZukZmyBoYGWyqG 2jVPreF/YY2HEHomvhR8oMHsD2i2yin8vsJbu3vKmL8uOUszoif592jG9h2gaylp7Y7N lI4w== X-Received: by 10.66.192.198 with SMTP id hi6mr75027048pac.87.1386072580291; Tue, 03 Dec 2013 04:09:40 -0800 (PST) Received: from alpha.taobao.ali.com ([182.92.247.2]) by mx.google.com with ESMTPSA id xv2sm129628866pbb.39.2013.12.03.04.09.38 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Dec 2013 04:09:39 -0800 (PST) From: Zheng Liu To: linux-ext4@vger.kernel.org Cc: Theodore Ts'o , "Darrick J. Wong" , Zheng Liu Subject: [PATCH v2 15/28] debugfs: handle inline_data feature in bmap command Date: Tue, 3 Dec 2013 20:11:42 +0800 Message-Id: <1386072715-9869-16-git-send-email-wenqing.lz@taobao.com> X-Mailer: git-send-email 1.7.9.7 In-Reply-To: <1386072715-9869-1-git-send-email-wenqing.lz@taobao.com> References: <1386072715-9869-1-git-send-email-wenqing.lz@taobao.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Zheng Liu No physical block mapping if an inode has inline data. Signed-off-by: Theodore Ts'o Signed-off-by: Zheng Liu --- lib/ext2fs/bmap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/ext2fs/bmap.c b/lib/ext2fs/bmap.c index 5074587..0d043bd 100644 --- a/lib/ext2fs/bmap.c +++ b/lib/ext2fs/bmap.c @@ -273,6 +273,13 @@ errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, block_buf = buf; } + /* + * If an inode has inline data, that means that it doesn't have + * any blocks and we shouldn't map any blocks for it. + */ + if (inode->i_flags & EXT4_INLINE_DATA_FL) + goto done; + if (inode->i_flags & EXT4_EXTENTS_FL) { retval = ext2fs_extent_open2(fs, ino, inode, &handle); if (retval)