Re: [RFC PATCH v5] f2fs: support data compression
From: Geert Uytterhoeven
Date: Thu Dec 19 2019 - 04:54:06 EST
On Mon, Dec 16, 2019 at 7:29 AM Chao Yu <yuchao0@xxxxxxxxxx> 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@xxxxxxxxxxxxxx
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