From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kara Subject: Re: [PATCH 0/2] Improve writeout pattern from xfs_flush_pages() Date: Thu, 4 Aug 2011 12:36:16 +0200 Message-ID: <20110804103616.GF17196@quack.suse.cz> References: <1312404545-15400-1-git-send-email-jack@suse.cz> <20110803214206.GA20477@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jan Kara , xfs@oss.sgi.com, linux-fsdevel@vger.kernel.org To: Christoph Hellwig Return-path: Received: from cantor2.suse.de ([195.135.220.15]:34280 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753640Ab1HDKgR (ORCPT ); Thu, 4 Aug 2011 06:36:17 -0400 Content-Disposition: inline In-Reply-To: <20110803214206.GA20477@infradead.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed 03-08-11 17:42:06, Christoph Hellwig wrote: > On Wed, Aug 03, 2011 at 10:49:03PM +0200, Jan Kara wrote: > > > > Hi, > > > > at one of customer's machines, I've spotted an issue that sync(1) called > > after writing a single huge file has been achieving rather low throughput. After > > debugging this with blktrace, I've found that the culprit was in flusher thread > > racing with page writeout happening from XFS sync code. The patches below helped > > that case. Although they are not a complete solution, I belive they are useful > > anyway so please consider merging them... > > We currently have three calls to xfs_flush_pages with XBF_ASYNC set: > > - xfs_setattr_size > - xfs_sync_inode_data > - xfs_release > > The first one actually is a synchronous writeout, just implemented in > a rather odd way by doing the xfs_ioend_wait right after it, so your > change is actively harmful for it. Oh, right. BTW cannot be truncate livelocked on a busy file because of that xfs_ioend_wait()? > The second is only called from xfs_flush_worker, which is the workqueue > offload when we hit ENOSPC. I can see how this might race with the > writeback code, but the correct fix is to replace it with a call to > writeback_inodes_sb(_if_idle) on that one is fixed to do a trylock on > s_umount and thus won't deadlock. OK. > The third one is opportunistic writeout if a file got truncated down on > final release. filemap_flush probably is fine here, but there's no need > for a range version. If you replace it with filemap_flush please also > kill the useless wrapper while you're at it. Do you mean xfs_flush_pages()? OK, I can do that. Thanks for having a look. Honza -- Jan Kara SUSE Labs, CR