Re: [PATCH 10/13] fuse: add support for multiple writeback contexts in fuse

Bernd Schubert
2025-06-02T15:50:55Z

On 6/2/25 16:21, Christoph Hellwig wrote:
>> static void fuse_writepage_finish_stat(struct inode *inode, struct folio *folio)
>> {
>> - struct backing_dev_info *bdi = inode_to_bdi(inode);
>> + struct bdi_writeback_ctx *bdi_wb_ctx = fetch_bdi_writeback_ctx(inode);
>>
>> - dec_wb_stat(&bdi->wb_ctx_arr[0]->wb, WB_WRITEBACK);
>> + dec_wb_stat(&bdi_wb_ctx->wb, WB_WRITEBACK);
>> node_stat_sub_folio(folio, NR_WRITEBACK_TEMP);
>> - wb_writeout_inc(&bdi->wb_ctx_arr[0]->wb);
>> + wb_writeout_inc(&bdi_wb_ctx->wb);
>> }
>
> There's nothing fuse-specific here except that nothing but fuse uses
> NR_WRITEBACK_TEMP. Can we try to move this into the core first so that
> the patches don't have to touch file system code?
>
>> - inc_wb_stat(&inode_to_bdi(inode)->wb_ctx_arr[0]->wb, WB_WRITEBACK);
>> + inc_wb_stat(&bdi_wb_ctx->wb, WB_WRITEBACK);
>> node_stat_add_folio(tmp_folio, NR_WRITEBACK_TEMP);
>
> Same here. On pattern is that fuse and nfs both touch the node stat
> and the web stat, and having a common helper doing both would probably
> also be very helpful.
>
>

Note that Miklos' PR for 6.16 removes NR_WRITEBACK_TEMP through
patches from Joanne, i.e. only

dec_wb_stat(&bdi->wb, WB_WRITEBACK);

is left over.

Thanks,
Bernd