Re: [PATCH] Btrfs-progs: setup framework to corrupt specific fields of an inode V2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 06, 2013 at 09:26:19AM -0400, Josef Bacik wrote:
> @@ -93,6 +95,9 @@ static void print_usage(void)
>  	fprintf(stderr, "\t-b Number of bytes to be corrupted\n");
>  	fprintf(stderr, "\t-e Extent to be corrupted\n");
>  	fprintf(stderr, "\t-E The whole extent free to be corrupted\n");
> +	fprintf(stderr, "\t-i The inode item to corrupt (must also specify "
> +		"the field to corrupt\n");

forgotten )

> +	fprintf(stderr, "\t-f The field in the item to corrupt\n");
>  	exit(1);
>  }
>  
> @@ -344,10 +442,6 @@ int main(int ac, char **av)
>  	ac = ac - optind;
>  	if (ac == 0)
>  		print_usage();
> -	if (logical == 0 && !extent_tree)
> -		print_usage();
> -	if (copy < 0)
> -		print_usage();

Please base your patches on something more recent, I merged this hunk
manually 2 times already and it starts to diverge from trivial fixups
(which I'm fine with).

>  
>  	dev = av[optind];
>  
> @@ -361,6 +455,9 @@ int main(int ac, char **av)
>  	}
>  	if (extent_rec) {
>  		struct btrfs_trans_handle *trans;
> +
> +		if (logical == 0)

now it's (u64)-1 as the "invalie" value, and has to be added to the
'chunk_tree' branch as well.

> +			print_usage();
>  		trans = btrfs_start_transaction(root, 1);
>  		ret = corrupt_extent (trans, root, logical, 0);
>  		btrfs_commit_transaction(trans, root);
> @@ -374,6 +471,20 @@ int main(int ac, char **av)
>  		btrfs_commit_transaction(trans, root);
>  		goto out_close;
>  	}
> +	if (inode) {
> +		struct btrfs_trans_handle *trans;
> +
> +		if (!strlen(field))
> +			print_usage();
> +		printf("corrupting inode\n");
> +		trans = btrfs_start_transaction(root, 1);
> +		ret = corrupt_inode(trans, root, inode, field);
> +		btrfs_commit_transaction(trans, root);
> +		goto out_close;
> +	}
> +
> +	if (logical == 0)

same here

> +		print_usage();
>  
>  	if (bytes == 0)
>  		bytes = root->sectorsize;

All fixed and patch replaced in the middle of the branch, feel free to
review that I did not mess it up.

david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux