Re: [PATCH 3/6] writeback: make nr_to_write a per-file limit

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

 



> - move MAX_WRITEBACK_PAGES and wb_writeback_work definitions to writeback.h

I think it would be a good idea to keep this in fs/fs-writeback.c, which
means we'd need a small writeback_inodes_wb wrapper for
balance_dirty_pages and bdi_flush_io.  But IIRC your tree already has
__writeback_inodes_wb for use in wb_writeback, so writeback_inodes_wb
could be that wrapper.

> +	long write_chunk = MAX_WRITEBACK_PAGES;
> +	long wrote = 0;
> +	bool inode_cleaned = false;
> +
> +	/*
> +	 * WB_SYNC_ALL mode does livelock avoidance by syncing dirty
> +	 * inodes/pages in one big loop. Setting wbc.nr_to_write=LONG_MAX
> +	 * here avoids calling into writeback_inodes_wb() more than once.
> +	 *
> +	 * The intended call sequence for WB_SYNC_ALL writeback is:
> +	 *
> +	 *      wb_writeback()
> +	 *          writeback_sb_inodes()       <== called only once
> +	 *              write_cache_pages()     <== called once for each inode
> +	 *                   (quickly) tag currently dirty pages
> +	 *                   (maybe slowly) sync all tagged pages
> +	 */
> +	if (work->sync_mode == WB_SYNC_ALL || work->tagged_sync)
> +		write_chunk = LONG_MAX;

I think this would be easier to read if kept as and if / else clause
with the MAX_WRITEBACK_PAGES usage.

> +		write_chunk = min(write_chunk, work->nr_pages);

Or in fact done here - for the WB_SYNC_ALL case LONG_MAX should
always be larger than work->nr_pages, so the whole thing could be
simplified to:

		if (work->sync_mode == WB_SYNC_ALL || work->tagged_sync)
			write_chunk = LONG_MAX;
		else
			write_chunk = min(MAX_WRITEBACK_PAGES, work->nr_pages);


Other notes:

 - older_than_this in writeback_control shouldn't be needed anymore
 - is the early return for the mis-matching sb in writeback_sb_inodes
   handled correctly?  Before it had the special 0 return value, and
   I'm not quite sure how that fits into your new enum scheme.
--
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