lkml.org 
[lkml]   [2019]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC PATCH v5] f2fs: support data compression
On Mon, Dec 16, 2019 at 7:29 AM Chao Yu <yuchao0@huawei.com> wrote:
> This patch tries to support compression in f2fs.

> +static int f2fs_write_raw_pages(struct compress_ctx *cc,
> + int *submitted,
> + struct writeback_control *wbc,
> + enum iostat_type io_type,
> + bool compressed)
> +{
> + int i, _submitted;
> + int ret, err = 0;
> +
> + for (i = 0; i < cc->cluster_size; i++) {
> + if (!cc->rpages[i])
> + continue;
> +retry_write:
> + BUG_ON(!PageLocked(cc->rpages[i]));
> +
> + ret = f2fs_write_single_data_page(cc->rpages[i], &_submitted,
> + NULL, NULL, wbc, io_type);
> + if (ret) {
> + if (ret == AOP_WRITEPAGE_ACTIVATE) {
> + unlock_page(cc->rpages[i]);
> + ret = 0;
> + } else if (ret == -EAGAIN) {
> + ret = 0;
> + cond_resched();
> + congestion_wait(BLK_RW_ASYNC, HZ/50);

On some platforms, HZ can be less than 50.
What happens if congestion_wait() is called with a zero timeout?

> + lock_page(cc->rpages[i]);
> + clear_page_dirty_for_io(cc->rpages[i]);
> + goto retry_write;
> + }
> + err = ret;
> + goto out_fail;
> + }
> +
> + *submitted += _submitted;
> + }
> + return 0;
> +
> +out_fail:
> + /* TODO: revoke partially updated block addresses */
> + BUG_ON(compressed);
> +
> + for (++i; i < cc->cluster_size; i++) {
> + if (!cc->rpages[i])
> + continue;
> + redirty_page_for_writepage(wbc, cc->rpages[i]);
> + unlock_page(cc->rpages[i]);
> + }
> + return err;
> +}

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

\
 
 \ /
  Last update: 2019-12-19 10:54    [W:0.194 / U:1.844 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site