[Devel] [PATCH rh7 3/3] ve/fs/sync: per containter sync and syncfs

Vladimir Davydov vdavydov at virtuozzo.com
Fri Jan 29 05:53:52 PST 2016


On Fri, Jan 29, 2016 at 01:12:50PM +0300, Andrey Ryabinin wrote:
> The implementation is straightforward, since we already have per container
> writeback. Sync just get user beancounter and launches writeback work for it.
> 
> Note that per container sync[fs] works only for dirty data. Dirty metadata
> will be written out. This logic was inherted from PCS6
> (see diff-ubc-dont-skip-dirty-metadata-on-filtered-sync patch).

Please port this commit in a separate patch.

> 
> https://jira.sw.ru/browse/PSBM-39583
> 
> Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
> ---
>  fs/buffer.c               |  2 +-
>  fs/fs-writeback.c         | 82 ++++++++++++++++++++++++++++++++---------------
>  fs/sync.c                 | 17 ++++++----
>  include/linux/writeback.h |  6 +++-
>  mm/vmscan.c               |  2 +-
>  5 files changed, 74 insertions(+), 35 deletions(-)
> 
> diff --git a/fs/buffer.c b/fs/buffer.c
> index 2b709d4..d1eb45e 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -279,7 +279,7 @@ static void free_more_memory(void)
>  	struct zone *zone;
>  	int nid;
>  
> -	wakeup_flusher_threads(1024, WB_REASON_FREE_MORE_MEM);
> +	wakeup_flusher_threads(1024, NULL, WB_REASON_FREE_MORE_MEM);

Let's not change wakeup_flusher_threads() signature - it's used in
different parts of the kernel, so it's going to be difficult to rebase
IMO. Let's instead introduce wakeup_flusher_threads_ub() for our
purposes.

>  	yield();
>  
>  	for_each_online_node(nid) {
...
> diff --git a/fs/sync.c b/fs/sync.c
> index ba033c1..bef5163 100644
> --- a/fs/sync.c
> +++ b/fs/sync.c
> @@ -35,9 +35,9 @@ static int __sync_filesystem(struct super_block *sb,
>  			     struct user_beancounter *ub, int wait)
>  {
>  	if (wait)
> -		sync_inodes_sb(sb);
> +		sync_inodes_sb_ub(sb, ub);
>  	else
> -		writeback_inodes_sb(sb, WB_REASON_SYNC);
> +		writeback_inodes_sb_ub(sb, ub, WB_REASON_SYNC);
>  
>  	if (sb->s_op->sync_fs)
>  		sb->s_op->sync_fs(sb, wait);
...
> @@ -154,15 +154,18 @@ SYSCALL_DEFINE0(sync)
>  		fsb = __ve_fsync_behavior(ve);
>  		if (fsb == FSYNC_NEVER)
>  			goto skip;
> +
> +		if (fsb == FSYNC_FILTERED)
> +			sync_ub = get_io_ub();
>  	}
>  
> -	wakeup_flusher_threads(0, WB_REASON_SYNC);
> -	iterate_supers(sync_inodes_one_sb, NULL);
> +	wakeup_flusher_threads(0, ub, WB_REASON_SYNC);
> +	iterate_supers(sync_inodes_one_sb, sync_ub);

i.e. we will call ->sync_fs and __sync_blockdev for every super block
when sync() is called from inside a container. I don't think it's good.
I suppose the stuff you reverted in patch #1 was introduced to avoid
that. Why do you think we don't need it now?


More information about the Devel mailing list