From patchwork Tue Jan 3 12:13:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lakshmipathi.G" X-Patchwork-Id: 9495811 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 09ACA60405 for ; Tue, 3 Jan 2017 23:02:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF53626E82 for ; Tue, 3 Jan 2017 23:02:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2EEC2793A; Tue, 3 Jan 2017 23:02:40 +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 5EE2F26E82 for ; Tue, 3 Jan 2017 23:02:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759014AbdACXCh (ORCPT ); Tue, 3 Jan 2017 18:02:37 -0500 Received: from smtpq5.tb.mail.iss.as9143.net ([212.54.42.168]:43177 "EHLO smtpq5.tb.mail.iss.as9143.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752594AbdACXCg (ORCPT ); Tue, 3 Jan 2017 18:02:36 -0500 Received: from [212.54.42.118] (helo=lsmtp4.tb.mail.iss.as9143.net) by smtpq5.tb.mail.iss.as9143.net with esmtp (Exim 4.86_2) (envelope-from ) id 1cOXh4-00006P-UR for linux-btrfs@vger.kernel.org; Tue, 03 Jan 2017 23:36:34 +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 1cOXh4-0002fI-Rq for linux-btrfs@vger.kernel.org; Tue, 03 Jan 2017 23:36:34 +0100 Received: from localhost.localdomain (fedori [127.0.0.1]) by webminal.org (8.14.4/8.14.4) with ESMTP id v03CDx39026018 for ; Tue, 3 Jan 2017 13:14:09 +0100 Received: (from laks@localhost) by localhost.localdomain (8.14.4/8.14.4/Submit) id v03CDmfw025771 for linux-btrfs@vger.kernel.org; Tue, 3 Jan 2017 13:13:48 +0100 Date: Tue, 3 Jan 2017 13:13:48 +0100 From: "Lakshmipathi.G" To: linux-btrfs@vger.kernel.org Subject: [PATCH] btrfs-progs: Corruption-framework: Include inode nlink field Message-ID: <20170103121348.GA23094@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=y_e09CZNqqXB8qZqmLYA: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 Will include other fields, if this gets accepted. 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..64376ca 100644 --- a/btrfs-corrupt-block.c +++ b/btrfs-corrupt-block.c @@ -309,6 +309,7 @@ enum btrfs_inode_field { BTRFS_INODE_FIELD_ISIZE, BTRFS_INODE_FIELD_NBYTES, BTRFS_INODE_FIELD_BAD, + BTRFS_INODE_FIELD_NLINK, }; enum btrfs_file_extent_field { @@ -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;