Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The first arg of submit_bio is used for block dump #13006

Merged
merged 1 commit into from
Jan 25, 2022

Conversation

Finix1979
Copy link
Contributor

Because some kernel version of submit_bio use the first argument for block dump function. We could use the result of bio_data_dir instead of 0.

Signed-off-by: Finix Yan yancw@info2soft.com

Motivation and Context

When enable block dump by "echo 1 > /proc/sys/vm/block_dump"
I got "[47410.364655] z_wr_int(17446): READ block 1348575456 on nvme0n1p1 (8 sectors)"
But from iostat it shows this block device only has WRITE operation.

I notice that submit_bio of kernel 3.10 use the first argument "rw" for statistic.

void submit_bio(int rw, struct bio *bio)
{
.......
if (unlikely(block_dump)) {
char b[BDEVNAME_SIZE];
printk(KERN_DEBUG "%s(%d): %s block %Lu on %s (%u sectors)\n",
current->comm, task_pid_nr(current),
(rw & WRITE) ? "WRITE" : "READ",
(unsigned long long)bio->bi_sector,
bdevname(bio->bi_bdev, b),
count);
}
}

The output of block dump always reports READ instead of WRITE because rw is passed 0.

Description

How Has This Been Tested?

Types of changes

  • [x ] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

Because some kernel version of submit_bio use the first argument for block dump function. We could use the result of bio_data_dir instead of 0.

Signed-off-by: Finix Yan <yancw@info2soft.com>
Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, thanks for catching and fixing this.

@behlendorf behlendorf added the Status: Accepted Ready to integrate (reviewed, tested) label Jan 24, 2022
@behlendorf behlendorf merged commit a3fbe2b into openzfs:master Jan 25, 2022
@Finix1979 Finix1979 deleted the submit_bio branch January 26, 2022 13:58
tonyhutter pushed a commit that referenced this pull request Feb 4, 2022
When using the two argument version of submit_bio() in kernel's prior
to 4.8 the first argument should be specified.  It's used by block
dump to report the bio direction.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Finix Yan <yancw@info2soft.com>
Closes #13006
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
When using the two argument version of submit_bio() in kernel's prior
to 4.8 the first argument should be specified.  It's used by block
dump to report the bio direction.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Finix Yan <yancw@info2soft.com>
Closes openzfs#13006
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
When using the two argument version of submit_bio() in kernel's prior
to 4.8 the first argument should be specified.  It's used by block
dump to report the bio direction.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Finix Yan <yancw@info2soft.com>
Closes openzfs#13006
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants