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

discard the segment to acquire #113

Open
akiradeveloper opened this issue Jun 19, 2016 · 3 comments
Open

discard the segment to acquire #113

akiradeveloper opened this issue Jun 19, 2016 · 3 comments
Assignees

Comments

@akiradeveloper
Copy link
Owner

dm-writeboost uses SSD cache device like logging. It splits whole region into segments and when it reaches the last, it returns back to the first segment.

Telling the SSD device that all the cache blocks in the segment is now needless and can be reclaimed is useful because log could be partial. Partial log doesn't overwrite the segment in full extent so rest of the region that wasn't overwritten is still being recognized as non-reclaimable.

But my past experiment showed that discard is not costless so I just keep a memo.

@akiradeveloper
Copy link
Owner Author

this is unlikely to occur but if we don't discard the segment everytime, the SSD controller can never realize some blocks in the segment are reclaimable because there isn't overwrite on the blocks. SSD controller can naturally realize some blocks are reclaimable when they are overwritten but otherwise no chance to realize it.

So these blocks are always kept in flash blocks inside the SSD and may cause massive copying.

It would be better to discard segments

@akiradeveloper
Copy link
Owner Author

but please be sure that no bad impact on the performance. This should be easily measurable by randwrite test

@akiradeveloper
Copy link
Owner Author

If we do this, we should insert blkdev_issue_discard into

void acquire_new_seg(struct wb_device *wb, u64 id)
{
    struct segment_header *new_seg = get_segment_header_by_id(wb, id);

    /*
     * We wait for all requests to the new segment is consumed.
     * Mutex taken guarantees that no new I/O to this segment is coming in.
     */
    wait_event(wb->inflight_ios_wq,
        !atomic_read(&new_seg->nr_inflight_ios));

    wait_for_writeback(wb, SUB_ID(id, wb->nr_segments));
    if (count_dirty_caches_remained(new_seg)) {
        DMERR("%u dirty caches remained. id:%llu",
              count_dirty_caches_remained(new_seg), id);
        BUG();
    }
    discard_caches_inseg(wb, new_seg);
    // HERE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant