Commit 56d140f5 authored by Stefan Behrens's avatar Stefan Behrens Committed by Chris Mason

Btrfs: print bytenr instead of page pointer in check-int

The page pointer information was useless. The bytenr is what you
want when you search for submitted write bios.

Additionally, a new bit in the print mask is added that allows
to selectively enable the check-int submit_bio verbose mode. Before,
the global verbose mode had to be enabled leading to many million
useless lines in the kernel log.

And a comment is added that explains that LOG_BUF_SHIFT needs to
be set to a really high value.
Signed-off-by: default avatarStefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent 9650e05c
...@@ -77,6 +77,15 @@ ...@@ -77,6 +77,15 @@
* the integrity of (super)-block write requests, do not * the integrity of (super)-block write requests, do not
* enable the config option BTRFS_FS_CHECK_INTEGRITY to * enable the config option BTRFS_FS_CHECK_INTEGRITY to
* include and compile the integrity check tool. * include and compile the integrity check tool.
*
* Expect millions of lines of information in the kernel log with an
* enabled check_int_print_mask. Therefore set LOG_BUF_SHIFT in the
* kernel config to at least 26 (which is 64MB). Usually the value is
* limited to 21 (which is 2MB) in init/Kconfig. The file needs to be
* changed like this before LOG_BUF_SHIFT can be set to a high value:
* config LOG_BUF_SHIFT
* int "Kernel log buffer size (16 => 64KB, 17 => 128KB)"
* range 12 30
*/ */
#include <linux/sched.h> #include <linux/sched.h>
...@@ -124,6 +133,7 @@ ...@@ -124,6 +133,7 @@
#define BTRFSIC_PRINT_MASK_INITIAL_DATABASE 0x00000400 #define BTRFSIC_PRINT_MASK_INITIAL_DATABASE 0x00000400
#define BTRFSIC_PRINT_MASK_NUM_COPIES 0x00000800 #define BTRFSIC_PRINT_MASK_NUM_COPIES 0x00000800
#define BTRFSIC_PRINT_MASK_TREE_WITH_ALL_MIRRORS 0x00001000 #define BTRFSIC_PRINT_MASK_TREE_WITH_ALL_MIRRORS 0x00001000
#define BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH_VERBOSE 0x00002000
struct btrfsic_dev_state; struct btrfsic_dev_state;
struct btrfsic_state; struct btrfsic_state;
...@@ -3015,6 +3025,7 @@ void btrfsic_submit_bio(int rw, struct bio *bio) ...@@ -3015,6 +3025,7 @@ void btrfsic_submit_bio(int rw, struct bio *bio)
(rw & WRITE) && NULL != bio->bi_io_vec) { (rw & WRITE) && NULL != bio->bi_io_vec) {
unsigned int i; unsigned int i;
u64 dev_bytenr; u64 dev_bytenr;
u64 cur_bytenr;
int bio_is_patched; int bio_is_patched;
char **mapped_datav; char **mapped_datav;
...@@ -3033,6 +3044,7 @@ void btrfsic_submit_bio(int rw, struct bio *bio) ...@@ -3033,6 +3044,7 @@ void btrfsic_submit_bio(int rw, struct bio *bio)
GFP_NOFS); GFP_NOFS);
if (!mapped_datav) if (!mapped_datav)
goto leave; goto leave;
cur_bytenr = dev_bytenr;
for (i = 0; i < bio->bi_vcnt; i++) { for (i = 0; i < bio->bi_vcnt; i++) {
BUG_ON(bio->bi_io_vec[i].bv_len != PAGE_CACHE_SIZE); BUG_ON(bio->bi_io_vec[i].bv_len != PAGE_CACHE_SIZE);
mapped_datav[i] = kmap(bio->bi_io_vec[i].bv_page); mapped_datav[i] = kmap(bio->bi_io_vec[i].bv_page);
...@@ -3044,16 +3056,13 @@ void btrfsic_submit_bio(int rw, struct bio *bio) ...@@ -3044,16 +3056,13 @@ void btrfsic_submit_bio(int rw, struct bio *bio)
kfree(mapped_datav); kfree(mapped_datav);
goto leave; goto leave;
} }
if ((BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH | if (dev_state->state->print_mask &
BTRFSIC_PRINT_MASK_VERBOSE) == BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH_VERBOSE)
(dev_state->state->print_mask &
(BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH |
BTRFSIC_PRINT_MASK_VERBOSE)))
printk(KERN_INFO printk(KERN_INFO
"#%u: page=%p, len=%u, offset=%u\n", "#%u: bytenr=%llu, len=%u, offset=%u\n",
i, bio->bi_io_vec[i].bv_page, i, cur_bytenr, bio->bi_io_vec[i].bv_len,
bio->bi_io_vec[i].bv_len,
bio->bi_io_vec[i].bv_offset); bio->bi_io_vec[i].bv_offset);
cur_bytenr += bio->bi_io_vec[i].bv_len;
} }
btrfsic_process_written_block(dev_state, dev_bytenr, btrfsic_process_written_block(dev_state, dev_bytenr,
mapped_datav, bio->bi_vcnt, mapped_datav, bio->bi_vcnt,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment