master - pvck: use bcache
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e7670d333855ecccb21b30bc6b4525d6bafaa940 Commit: e7670d333855ecccb21b30bc6b4525d6bafaa940 Parent: b504bb809efa8a3a4db0e494bb80d3720d82e6ff Author: David Teigland <[email protected]> AuthorDate: Thu Feb 15 11:06:50 2018 -0600 Committer: David Teigland <[email protected]> CommitterDate: Fri Apr 20 11:22:47 2018 -0500
pvck: use bcache
--- lib/format_text/format-text.c | 24 +++++++++++++++++------- tools/pvck.c | 2 ++ 2 files changed, 19 insertions(+), 7 deletions(-)
lib/format_text/format-text.c +17 -7
@@ -187,9 +187,6 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt, FMTu64, mdac->area.start, mdac->area.size); area = &mdac->area; -if (!dev_open_readonly (area->dev)) - return_0; -if (!(mdah =raw_read_mda_header (fmt, area,mda_is_primary (mda)))) goto_out;
@@ -230,8 +227,23 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,if (!(buf =dm_malloc (size + size2))) goto_out; -if (!dev_read_circular (area->dev, offset, size, offset2, size2,MDA_CONTENT_REASON (mda_is_primary (mda)), buf)) - goto_out; +if (!bcache_read_bytes (scan_bcache, area->dev->bcache_fd, offset, size, buf)) { +log_error ("Failed to read dev %s offset %llu size %llu" , +dev_name (area->dev), + (unsigned long long )offset, + (unsigned long long )size); + goto out; + } + +if (size2) { +if (!bcache_read_bytes (scan_bcache, area->dev->bcache_fd, offset2, size2, buf + size)) { +log_error ("Failed to read dev %s offset %llu size %llu" , +dev_name (area->dev), + (unsigned long long )offset2, + (unsigned long long )size2); + goto out; + } + }/* * FIXME: We could add more sophisticated metadata detection
@@ -268,8 +280,6 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt, r =1 ; out:dm_free (buf); -if (!dev_close (area->dev)) - stack;return r; }
tools/pvck.c +2 -0
@@ -23,6 +23,8 @@ int pvck(struct cmd_context *cmd, int argc, char **argv)/* FIXME: validate cmdline options */ /* FIXME: what does the cmdline look like? */ +label_scan_setup_bcache (); +/* * Use what's on the cmdline directly, and avoid calling into * some of the other infrastructure functions, so as to avoid