Merge PR #24874 into master

* refs/pull/24874/head:
	os/filestore: collect partition/device metadata from journal
	os/filestore: include journal in get_devices result

Reviewed-by: Rick Chen <rick.chen@prophetstor.com>
Reviewed-by: Brad Hubbard <bhubbard@redhat.com>
This commit is contained in:
Sage Weil 2018-11-19 17:31:17 -06:00
commit 38e95b2d8a
5 changed files with 42 additions and 0 deletions

View File

@ -89,3 +89,4 @@ dillaman Jason Dillaman <dillaman@redhat.com>
batrick Patrick Donnelly <pdonnell@redhat.com>
noahdesu Noah Watkins <nwatkins@redhat.com>
tserong Tim Serong <tserong@suse.com>
hsiang41 Rick Chen <rick.chen@prophetstor.com>

View File

@ -2185,3 +2185,33 @@ off64_t FileJournal::get_journal_size_estimate()
dout(20) << __func__ << " journal size=" << size << dendl;
return size;
}
void FileJournal::get_devices(set<string> *ls)
{
char dev_node[PATH_MAX];
BlkDev blkdev(fd);
if (int rc = blkdev.wholedisk(dev_node, PATH_MAX); rc) {
return;
}
ls->insert(dev_node);
if (strncmp(dev_node, "dm-", 3) == 0) {
get_dm_parents(dev_node, ls);
}
}
void FileJournal::collect_metadata(map<string,string> *pm)
{
BlkDev blkdev(fd);
char partition_path[PATH_MAX];
char dev_node[PATH_MAX];
if (blkdev.partition(partition_path, PATH_MAX)) {
(*pm)["backend_filestore_journal_partition_path"] = "unknown";
} else {
(*pm)["backend_filestore_journal_partition_path"] = string(partition_path);
}
if (blkdev.wholedisk(dev_node, PATH_MAX)) {
(*pm)["backend_filestore_journal_dev_node"] = "unknown";
} else {
(*pm)["backend_filestore_journal_dev_node"] = string(dev_node);
}
}

View File

@ -463,6 +463,9 @@ private:
void flush() override;
void get_devices(set<string> *ls) override;
void collect_metadata(map<string,string> *pm) override;
void reserve_throttle_and_backoff(uint64_t count) override;
bool is_writeable() override {

View File

@ -708,6 +708,9 @@ void FileStore::collect_metadata(map<string,string> *pm)
(*pm)["vdo_physical_size"] =
stringify(4096 * get_vdo_stat(vdo_fd, "physical_blocks"));
}
if (journal) {
journal->collect_metadata(pm);
}
}
}
@ -722,6 +725,9 @@ int FileStore::get_devices(set<string> *ls)
if (strncmp(dev_node, "dm-", 3) == 0) {
get_dm_parents(dev_node, ls);
}
if (journal) {
journal->get_devices(ls);
}
return 0;
}

View File

@ -52,6 +52,8 @@ public:
virtual void flush() = 0;
virtual void get_devices(set<string> *ls) {}
virtual void collect_metadata(map<string,string> *pm) {}
/**
* reserve_throttle_and_backoff
*