Re: [PATCH 3/4] writeback: convert WB_WRITTEN/WB_DIRITED counters to bytes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue 20-09-16 16:57:47, Josef Bacik wrote:
> These are counters that constantly go up in order to do bandwidth calculations.
> It isn't important what the units are in, as long as they are consistent between
> the two of them, so convert them to count bytes written/dirtied, and allow the
> metadata accounting stuff to change the counters as well.
> 
> Signed-off-by: Josef Bacik <jbacik@xxxxxx>
> ---
>  fs/fuse/file.c                   |  4 ++--
>  include/linux/backing-dev-defs.h |  4 ++--
>  include/linux/backing-dev.h      |  2 +-
>  mm/backing-dev.c                 |  8 ++++----
>  mm/page-writeback.c              | 26 ++++++++++++++++----------
>  5 files changed, 25 insertions(+), 19 deletions(-)
> 
> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> index f394aff..3f5991e 100644
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -1466,7 +1466,7 @@ static void fuse_writepage_finish(struct fuse_conn *fc, struct fuse_req *req)
>  	for (i = 0; i < req->num_pages; i++) {
>  		dec_wb_stat(&bdi->wb, WB_WRITEBACK);
>  		dec_node_page_state(req->pages[i], NR_WRITEBACK_TEMP);
> -		wb_writeout_inc(&bdi->wb);
> +		wb_writeout_inc(&bdi->wb, PAGE_SIZE);

Nitpick: Rename this to wb_writeout_add()? You have to change all the call
sites anyway and it is more consistent with other naming.

> @@ -2523,6 +2523,7 @@ void account_metadata_dirtied(struct page *page, struct backing_dev_info *bdi,
>  	__mod_node_page_state(page_pgdat(page), NR_METADATA_DIRTY_BYTES,
>  			      bytes);
>  	__add_wb_stat(&bdi->wb, WB_METADATA_DIRTY_BYTES, bytes);
> +	__add_wb_stat(&bdi->wb, WB_DIRTIED_BYTES, bytes);
>  	current->nr_dirtied++;
>  	task_io_account_write(bytes);
>  	this_cpu_inc(bdp_ratelimits);
> @@ -2593,6 +2594,7 @@ void account_metadata_end_writeback(struct page *page,
>  	__add_wb_stat(&bdi->wb, WB_METADATA_WRITEBACK_BYTES, -bytes);
>  	__mod_node_page_state(page_pgdat(page), NR_METADATA_WRITEBACK_BYTES,
>  					 -bytes);
> +	__add_wb_stat(&bdi->wb, WB_WRITTEN_BYTES, bytes);
>  	local_irq_restore(flags);
>  }
>  EXPORT_SYMBOL(account_metadata_end_writeback);

It seems it would make sense to move this patch to be second in the
series so that above two functions could do the right thing from the
beginning.

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux