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

os/bluestore/BlueFS: support write time hint. #21511

Merged
merged 3 commits into from
Nov 8, 2018

Conversation

majianpeng
Copy link
Member

Now rocksdb support this feature in io_posix.cc. This feature make SSD better understand the data life and based on this to do prefer allocate and do correctly GC.
In kernel, this feature based on file or inode. For BlueFs, it use the same raw device for multi files. So i open multi rad-write for different write-hint. Then for write based on hint to choose fd.

@majianpeng
Copy link
Member Author

@liewegas . please review.

@majianpeng
Copy link
Member Author

@liewegas . ping

@stale
Copy link

stale bot commented Oct 18, 2018

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you are a maintainer or core committer, please follow-up on this issue to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@stale stale bot added the stale label Oct 18, 2018
@majianpeng majianpeng force-pushed the bluefs-support-writetimelifehint branch from b5bd7cd to 12f6c18 Compare October 29, 2018 07:57
@stale stale bot removed the stale label Oct 29, 2018
@majianpeng
Copy link
Member Author

@liewegas . Have you time to review this? Thanks!

@@ -227,6 +227,13 @@ class BlueRocksWritableFile : public rocksdb::WritableFile {
return false;
}

void SetWriteLifeTimeHint(rocksdb::Env::WriteLifeTimeHint hint) override {
if (hint == h->write_hint) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need this check?

@@ -47,6 +45,12 @@ KernelDevice::KernelDevice(CephContext* cct, aio_callback_t cb, void *cbpriv, ai
discard_thread(this),
injecting_crash(0)
{
fd_directs.resize(WRITE_LIFE_MAX);
Copy link
Contributor

Choose a reason for hiding this comment

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

you can use vector::resize(size, val) for to initialize here

}

for (i = 0; i < WRITE_LIFE_MAX; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably start from WRITE_LIFE_NONE

}

for (i = 0; i < WRITE_LIFE_MAX; i++) {
if (fcntl(fd_directs[i], F_SET_FILE_RW_HINT, &i) < 0) {
Copy link
Member

Choose a reason for hiding this comment

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

Will this fail on old kernels that we care about? Should we tolerate EOPNOTSUPP or similar?

Copy link
Member Author

Choose a reason for hiding this comment

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

If failed on old kernel, we disable enable_wrt and later in choose_fd, we only use fd_directs/fd_buffered[WRITE_LIFE_NOT_SET].

Copy link
Member

@liewegas liewegas left a comment

Choose a reason for hiding this comment

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

I like this!

@liewegas liewegas changed the title [RFC]Bluefs support write time hint. os/bluestore/BlueFS: support write time hint. Oct 30, 2018
@majianpeng majianpeng force-pushed the bluefs-support-writetimelifehint branch from 12f6c18 to 5a1d2f1 Compare October 31, 2018 08:43
Rocksdb already supported this feature for posix fs backend.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
@liewegas liewegas merged commit 5a1d2f1 into ceph:master Nov 8, 2018
liewegas added a commit that referenced this pull request Nov 8, 2018
* refs/pull/21511/head:
	os/bluefs: set logfile w/ WRITE_LIFE_MEDIUM
	os/bluefs: make super block w/ WRITE_LIFE_TIME_SHORT.
	os/bluestore: BlueFS support write_life_time feature of SSD.

Reviewed-by: Sage Weil <sage@redhat.com>
Reviewed-by: Igor Fedotov <ifedotov@suse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants