[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdVvqccd_iwdz8khxYKUjrD-pnBYggagVCYZyNmbZxB9Tw@mail.gmail.com>
Date: Thu, 19 Dec 2019 10:53:52 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Chao Yu <yuchao0@...wei.com>
Cc: Jaegeuk Kim <jaegeuk@...nel.org>,
linux-f2fs-devel@...ts.sourceforge.net,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Chao Yu <chao@...nel.org>
Subject: Re: [RFC PATCH v5] f2fs: support data compression
On Mon, Dec 16, 2019 at 7:29 AM Chao Yu <yuchao0@...wei.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@...ux-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
Powered by blists - more mailing lists