Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6aa21263 authored by David Sterba's avatar David Sterba
Browse files

btrfs: scrub: get rid of sector_t



The use of sector_t is not necessry, it's just for a warning.  Switch to
u64 and rename the variable and use byte units instead of 512b, ie.
dropping the >> 9 shifts.  The messages are adjusted as well.

Reviewed-by: default avatarLiu Bo <bo.li.liu@oracle.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 2351f431
Loading
Loading
Loading
Loading
+8 −8
Original line number Original line Diff line number Diff line
@@ -231,7 +231,7 @@ struct scrub_warning {
	struct btrfs_path	*path;
	struct btrfs_path	*path;
	u64			extent_item_size;
	u64			extent_item_size;
	const char		*errstr;
	const char		*errstr;
	sector_t		sector;
	u64			physical;
	u64			logical;
	u64			logical;
	struct btrfs_device	*dev;
	struct btrfs_device	*dev;
};
};
@@ -797,10 +797,10 @@ static int scrub_print_warning_inode(u64 inum, u64 offset, u64 root,
	 */
	 */
	for (i = 0; i < ipath->fspath->elem_cnt; ++i)
	for (i = 0; i < ipath->fspath->elem_cnt; ++i)
		btrfs_warn_in_rcu(fs_info,
		btrfs_warn_in_rcu(fs_info,
				  "%s at logical %llu on dev %s, sector %llu, root %llu, inode %llu, offset %llu, length %llu, links %u (path: %s)",
"%s at logical %llu on dev %s, physical %llu, root %llu, inode %llu, offset %llu, length %llu, links %u (path: %s)",
				  swarn->errstr, swarn->logical,
				  swarn->errstr, swarn->logical,
				  rcu_str_deref(swarn->dev->name),
				  rcu_str_deref(swarn->dev->name),
				  (unsigned long long)swarn->sector,
				  swarn->physical,
				  root, inum, offset,
				  root, inum, offset,
				  min(isize - offset, (u64)PAGE_SIZE), nlink,
				  min(isize - offset, (u64)PAGE_SIZE), nlink,
				  (char *)(unsigned long)ipath->fspath->val[i]);
				  (char *)(unsigned long)ipath->fspath->val[i]);
@@ -810,10 +810,10 @@ static int scrub_print_warning_inode(u64 inum, u64 offset, u64 root,


err:
err:
	btrfs_warn_in_rcu(fs_info,
	btrfs_warn_in_rcu(fs_info,
			  "%s at logical %llu on dev %s, sector %llu, root %llu, inode %llu, offset %llu: path resolving failed with ret=%d",
			  "%s at logical %llu on dev %s, physical %llu, root %llu, inode %llu, offset %llu: path resolving failed with ret=%d",
			  swarn->errstr, swarn->logical,
			  swarn->errstr, swarn->logical,
			  rcu_str_deref(swarn->dev->name),
			  rcu_str_deref(swarn->dev->name),
			  (unsigned long long)swarn->sector,
			  swarn->physical,
			  root, inum, offset, ret);
			  root, inum, offset, ret);


	free_ipath(ipath);
	free_ipath(ipath);
@@ -845,7 +845,7 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock)
	if (!path)
	if (!path)
		return;
		return;


	swarn.sector = (sblock->pagev[0]->physical) >> 9;
	swarn.physical = sblock->pagev[0]->physical;
	swarn.logical = sblock->pagev[0]->logical;
	swarn.logical = sblock->pagev[0]->logical;
	swarn.errstr = errstr;
	swarn.errstr = errstr;
	swarn.dev = NULL;
	swarn.dev = NULL;
@@ -868,10 +868,10 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock)
						      item_size, &ref_root,
						      item_size, &ref_root,
						      &ref_level);
						      &ref_level);
			btrfs_warn_in_rcu(fs_info,
			btrfs_warn_in_rcu(fs_info,
				"%s at logical %llu on dev %s, sector %llu: metadata %s (level %d) in tree %llu",
"%s at logical %llu on dev %s, physical %llu: metadata %s (level %d) in tree %llu",
				errstr, swarn.logical,
				errstr, swarn.logical,
				rcu_str_deref(dev->name),
				rcu_str_deref(dev->name),
				(unsigned long long)swarn.sector,
				swarn.physical,
				ref_level ? "node" : "leaf",
				ref_level ? "node" : "leaf",
				ret < 0 ? -1 : ref_level,
				ret < 0 ? -1 : ref_level,
				ret < 0 ? -1 : ref_root);
				ret < 0 ? -1 : ref_root);