From patchwork Thu Oct 9 17:34:45 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Katiyar X-Patchwork-Id: 3625 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.176.167]) by ozlabs.org (Postfix) with ESMTP id 3B1ABDE7E9 for ; Fri, 10 Oct 2008 04:34:50 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753664AbYJIRes (ORCPT ); Thu, 9 Oct 2008 13:34:48 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753298AbYJIRes (ORCPT ); Thu, 9 Oct 2008 13:34:48 -0400 Received: from ti-out-0910.google.com ([209.85.142.186]:48344 "EHLO ti-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753664AbYJIRer (ORCPT ); Thu, 9 Oct 2008 13:34:47 -0400 Received: by ti-out-0910.google.com with SMTP id b6so52776tic.23 for ; Thu, 09 Oct 2008 10:34:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:mime-version:content-type:content-transfer-encoding :content-disposition; bh=vIWfuVRMxmWFJzvQoqWtkmiG2wKlSytLeww6Y4r9OEE=; b=PPO0te5mK/MvRn/H9leFOD0g/S4E5+9Jr5H40z0v391ZII0814d43SpJRfuBmiYdur neCVp2WADY4VaRhtpW14jQ34mG8G+X3qwuQZWGHwQVrJYQKNLZkV8CNvuTYbe0JGSldp MWZpcK0SLo/HAbIyETL0A6ncTNR5beGtmzdOc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:mime-version:content-type :content-transfer-encoding:content-disposition; b=HfNxIdZo4htmEHm8Fyc+4msGfpUlUhJqAvGsE4AYxGSvxxybgXnebhaStMOx6zkfUQ g7Xp9Rg5I7HcNGA3R66pFHhYhTfEnFAY4RCpZOEPfywswZ9FeqlYn586rQKCQuwq07eC moZ9PGYg42DDmS1ZQ9o0Kv+rnMNwSN46x8wgM= Received: by 10.110.63.6 with SMTP id l6mr389535tia.4.1223573685847; Thu, 09 Oct 2008 10:34:45 -0700 (PDT) Received: by 10.110.39.8 with HTTP; Thu, 9 Oct 2008 10:34:45 -0700 (PDT) Message-ID: Date: Thu, 9 Oct 2008 23:04:45 +0530 From: "Manish Katiyar" To: ext4 , "Theodore Tso" Subject: [PATCH] debugfs : Fix printing of pathnames with ncheck if files have hardlinks in same directory. Cc: mkatiyar@gmail.com MIME-Version: 1.0 Content-Disposition: inline Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Hi Ted, Commit 03206bd introduced regression in ncheck while printing all the pathnames of an inode. For files which have hardlink in the same directory we will print the same pathname instead of all possible like below :- debugfs: ncheck 14 Inode Pathname 14 /a/f1 14 /a/f1 14 /b/f3 where it should have printed debugfs: ncheck 14 Inode Pathname 14 /a/f1 14 /a/f2 14 /b/f3 Below patch fixes it. Signed-off-by : Manish Katiyar --- debugfs/ncheck.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/debugfs/ncheck.c b/debugfs/ncheck.c index 22fa29f..c850739 100644 --- a/debugfs/ncheck.c +++ b/debugfs/ncheck.c @@ -36,14 +36,16 @@ static int ncheck_proc(struct ext2_dir_entry *dirent, int i; char *pathname; errcode_t retval; + static ext2_ino_t parent; iw->position++; + if (iw->position == 2) + parent = dirent->inode; if (iw->position <= 2) return 0; for (i=0; i < iw->num_inodes; i++) { if (iw->iarray[i] == dirent->inode) { - retval = ext2fs_get_pathname(current_fs, iw->parent, - iw->iarray[i], + retval = ext2fs_get_pathname(current_fs, parent, iw->parent, &pathname); if (retval) com_err("ncheck", retval, @@ -51,7 +53,7 @@ static int ncheck_proc(struct ext2_dir_entry *dirent, "inode %d (%d)", iw->parent, iw->iarray[i]); else - printf("%u\t%s\n", iw->iarray[i], pathname); + printf("%u\t%s/%s\n", iw->iarray[i], pathname, dirent->name); } } if (!iw->inodes_left)