* [PATCH] btrfs-progs: Corruption-framework: Include inode fields
@ 2017-01-05 17:03 Lakshmipathi.G
2017-01-17 15:47 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Lakshmipathi.G @ 2017-01-05 17:03 UTC (permalink / raw)
To: linux-btrfs
Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
---
btrfs-corrupt-block.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/btrfs-corrupt-block.c b/btrfs-corrupt-block.c
index a2f35ab..0e1eb52 100644
--- a/btrfs-corrupt-block.c
+++ b/btrfs-corrupt-block.c
@@ -309,6 +309,12 @@ enum btrfs_inode_field {
BTRFS_INODE_FIELD_ISIZE,
BTRFS_INODE_FIELD_NBYTES,
BTRFS_INODE_FIELD_NLINK,
+ BTRFS_INODE_FIELD_GENERATION,
+ BTRFS_INODE_FIELD_TRANSID,
+ BTRFS_INODE_FIELD_BLOCK_GROUP,
+ BTRFS_INODE_FIELD_MODE,
+ BTRFS_INODE_FIELD_UID,
+ BTRFS_INODE_FIELD_GID,
BTRFS_INODE_FIELD_BAD,
};
@@ -349,6 +355,18 @@ static enum btrfs_inode_field convert_inode_field(char *field)
return BTRFS_INODE_FIELD_NBYTES;
if (!strncmp(field, "nlink", FIELD_BUF_LEN))
return BTRFS_INODE_FIELD_NLINK;
+ if (!strncmp(field, "generation", FIELD_BUF_LEN))
+ return BTRFS_INODE_FIELD_GENERATION;
+ if (!strncmp(field, "transid", FIELD_BUF_LEN))
+ return BTRFS_INODE_FIELD_TRANSID;
+ if (!strncmp(field, "block_group", FIELD_BUF_LEN))
+ return BTRFS_INODE_FIELD_BLOCK_GROUP;
+ if (!strncmp(field, "mode", FIELD_BUF_LEN))
+ return BTRFS_INODE_FIELD_MODE;
+ if (!strncmp(field, "uid", FIELD_BUF_LEN))
+ return BTRFS_INODE_FIELD_UID;
+ if (!strncmp(field, "gid", FIELD_BUF_LEN))
+ return BTRFS_INODE_FIELD_GID;
return BTRFS_INODE_FIELD_BAD;
}
@@ -611,6 +629,36 @@ static int corrupt_inode(struct btrfs_trans_handle *trans,
bogus = generate_u32(orig);
btrfs_set_inode_nlink(path->nodes[0], ei, bogus);
break;
+ case BTRFS_INODE_FIELD_GENERATION:
+ orig = btrfs_inode_generation(path->nodes[0], ei);
+ bogus = generate_u64(orig);
+ btrfs_set_inode_generation(path->nodes[0], ei, bogus);
+ break;
+ case BTRFS_INODE_FIELD_TRANSID:
+ orig = btrfs_inode_transid(path->nodes[0], ei);
+ bogus = generate_u64(orig);
+ btrfs_set_inode_transid(path->nodes[0], ei, bogus);
+ break;
+ case BTRFS_INODE_FIELD_BLOCK_GROUP:
+ orig = btrfs_inode_block_group(path->nodes[0], ei);
+ bogus = generate_u64(orig);
+ btrfs_set_inode_block_group(path->nodes[0], ei, bogus);
+ break;
+ case BTRFS_INODE_FIELD_MODE:
+ orig = btrfs_inode_mode(path->nodes[0], ei);
+ bogus = generate_u32(orig);
+ btrfs_set_inode_mode(path->nodes[0], ei, bogus);
+ break;
+ case BTRFS_INODE_FIELD_UID:
+ orig = btrfs_inode_uid(path->nodes[0], ei);
+ bogus = generate_u32(orig);
+ btrfs_set_inode_uid(path->nodes[0], ei, bogus);
+ break;
+ case BTRFS_INODE_FIELD_GID:
+ orig = btrfs_inode_gid(path->nodes[0], ei);
+ bogus = generate_u32(orig);
+ btrfs_set_inode_gid(path->nodes[0], ei, bogus);
+ break;
default:
ret = -EINVAL;
break;
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs-progs: Corruption-framework: Include inode fields
2017-01-05 17:03 [PATCH] btrfs-progs: Corruption-framework: Include inode fields Lakshmipathi.G
@ 2017-01-17 15:47 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2017-01-17 15:47 UTC (permalink / raw)
To: Lakshmipathi.G; +Cc: linux-btrfs
On Thu, Jan 05, 2017 at 06:03:58PM +0100, Lakshmipathi.G wrote:
> Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-17 15:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-05 17:03 [PATCH] btrfs-progs: Corruption-framework: Include inode fields Lakshmipathi.G
2017-01-17 15:47 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).