From patchwork Thu Jan 5 10:08:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lakshmipathi.G" X-Patchwork-Id: 9499011 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 9652160413 for ; Thu, 5 Jan 2017 13:12:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D915283E5 for ; Thu, 5 Jan 2017 13:12:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8078D283EB; Thu, 5 Jan 2017 13:12:48 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 0D827283E5 for ; Thu, 5 Jan 2017 13:12:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033797AbdAENMY (ORCPT ); Thu, 5 Jan 2017 08:12:24 -0500 Received: from smtpq1.tb.mail.iss.as9143.net ([212.54.42.164]:34029 "EHLO smtpq1.tb.mail.iss.as9143.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936943AbdAENMU (ORCPT ); Thu, 5 Jan 2017 08:12:20 -0500 Received: from [212.54.42.118] (helo=lsmtp4.tb.mail.iss.as9143.net) by smtpq1.tb.mail.iss.as9143.net with esmtp (Exim 4.86_2) (envelope-from ) id 1cP7pZ-0007d9-Nf; Thu, 05 Jan 2017 14:11:45 +0100 Received: from dhcp-077-251-197-105.chello.nl ([77.251.197.105] helo=webminal.org) by lsmtp4.tb.mail.iss.as9143.net with esmtp (Exim 4.86_2) (envelope-from ) id 1cP7pP-000311-JZ; Thu, 05 Jan 2017 14:11:45 +0100 Received: from localhost.localdomain (fedori [127.0.0.1]) by webminal.org (8.14.4/8.14.4) with ESMTP id v05A8sCs005883; Thu, 5 Jan 2017 11:09:04 +0100 Received: (from laks@localhost) by localhost.localdomain (8.14.4/8.14.4/Submit) id v05A8Wwa005403; Thu, 5 Jan 2017 11:08:32 +0100 Date: Thu, 5 Jan 2017 11:08:32 +0100 From: "Lakshmipathi.G" To: linux-btrfs@vger.kernel.org, dsterba@suse.cz Subject: [PATCH] btrfs-progs: Corruption-framework: Include inode nlink field Message-ID: <20170105100832.GA1116@fedori> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-SourceIP: 77.251.197.105 X-Ziggo-spambar: / X-Ziggo-spamscore: 0.0 X-Ziggo-spamreport: CMAE Analysis: v=2.2 cv=LctM0nXi c=1 sm=1 tr=0 a=xM537bmGHqxVMGguserW4w==:17 a=kj9zAlcOel0A:10 a=IgFoBzBjUZAA:10 a=Ii29zHd6AAAA:8 a=3Jo8ru7zNQ6JNlaN1y0A:9 a=CjuIK1q_8ugA:10 a=hUl28ISp9AlOTif-od5a:22 none X-Ziggo-Spam-Status: No 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 Patch with fix for David Sterba review comment. Signed-off-by: Lakshmipathi.G --- btrfs-corrupt-block.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/btrfs-corrupt-block.c b/btrfs-corrupt-block.c index 16680df..a2f35ab 100644 --- a/btrfs-corrupt-block.c +++ b/btrfs-corrupt-block.c @@ -308,6 +308,7 @@ static void btrfs_corrupt_extent_tree(struct btrfs_trans_handle *trans, enum btrfs_inode_field { BTRFS_INODE_FIELD_ISIZE, BTRFS_INODE_FIELD_NBYTES, + BTRFS_INODE_FIELD_NLINK, BTRFS_INODE_FIELD_BAD, }; @@ -346,6 +347,8 @@ static enum btrfs_inode_field convert_inode_field(char *field) return BTRFS_INODE_FIELD_ISIZE; if (!strncmp(field, "nbytes", FIELD_BUF_LEN)) return BTRFS_INODE_FIELD_NBYTES; + if (!strncmp(field, "nlink", FIELD_BUF_LEN)) + return BTRFS_INODE_FIELD_NLINK; return BTRFS_INODE_FIELD_BAD; } @@ -603,6 +606,11 @@ static int corrupt_inode(struct btrfs_trans_handle *trans, bogus = generate_u64(orig); btrfs_set_inode_nbytes(path->nodes[0], ei, bogus); break; + case BTRFS_INODE_FIELD_NLINK: + orig = btrfs_inode_nlink(path->nodes[0], ei); + bogus = generate_u32(orig); + btrfs_set_inode_nlink(path->nodes[0], ei, bogus); + break; default: ret = -EINVAL; break;