public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH v4 8/8] xfs: add background scanning to clear EOFBLOCKS inodes
Date: Fri, 28 Sep 2012 16:42:34 -0400	[thread overview]
Message-ID: <50660BBA.2080500@redhat.com> (raw)
In-Reply-To: <20120928080009.GM25626@dastard>

On 09/28/2012 04:00 AM, Dave Chinner wrote:
> On Thu, Sep 27, 2012 at 01:45:52PM -0400, Brian Foster wrote:
>> Create a delayed_work to enable background scanning and freeing
>> of EOFBLOCKS inodes. The scanner kicks in once speculative
>> preallocation occurs and stops requeueing itself when no EOFBLOCKS
>> inodes exist.
>>
>> Scans are queued on the existing syncd workqueue and the interval
>> is based on the new eofb_timer tunable (default to 5m). The
>> background scanner performs unfiltered, best effort scans (which
>> skips inodes under lock contention or with a dirty cache mapping).
>>
>> Signed-off-by: Brian Foster <bfoster@redhat.com>
>> ---
>>  fs/xfs/xfs_globals.c |    1 +
>>  fs/xfs/xfs_linux.h   |    1 +
>>  fs/xfs/xfs_mount.h   |    2 ++
>>  fs/xfs/xfs_sync.c    |   30 ++++++++++++++++++++++++++++++
>>  fs/xfs/xfs_sysctl.c  |    9 +++++++++
>>  fs/xfs/xfs_sysctl.h  |    1 +
>>  6 files changed, 44 insertions(+), 0 deletions(-)
>>
>> diff --git a/fs/xfs/xfs_globals.c b/fs/xfs/xfs_globals.c
>> index 76e81cf..fda9a66 100644
>> --- a/fs/xfs/xfs_globals.c
>> +++ b/fs/xfs/xfs_globals.c
>> @@ -40,4 +40,5 @@ xfs_param_t xfs_params = {
>>  	.rotorstep	= {	1,		1,		255	},
>>  	.inherit_nodfrg	= {	0,		1,		1	},
>>  	.fstrm_timer	= {	1,		30*100,		3600*100},
>> +	.eofb_timer	= {	1*100,		300*100,	7200*100},
>>  };
>> diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
>> index 828662f..bbad99b 100644
>> --- a/fs/xfs/xfs_linux.h
>> +++ b/fs/xfs/xfs_linux.h
>> @@ -118,6 +118,7 @@
>>  #define xfs_rotorstep		xfs_params.rotorstep.val
>>  #define xfs_inherit_nodefrag	xfs_params.inherit_nodfrg.val
>>  #define xfs_fstrm_centisecs	xfs_params.fstrm_timer.val
>> +#define xfs_eofb_centisecs	xfs_params.eofb_timer.val
> 
> Let's not propagate that stupid "centiseconds" unit any further.
> Nobody uses it, and it was only introduced because jiffie was 10ms
> and there were 100 to a second so it was easy to convert in the
> code. I don't think there is any reason for needing sub-second
> granularity for this background function, so seconds shoul dbe just
> fine for it. If you think we nee dfiner granularity, milliseconds is
> the nex tunit to choose....
> 

I think seconds is fine. I chose 1s for a minimum, but even that is
pathological and really only useful for focused stress testing.

>>  
>>  #define current_cpu()		(raw_smp_processor_id())
>>  #define current_pid()		(current->pid)
>> diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
>> index deee09e..bf5ecfa 100644
>> --- a/fs/xfs/xfs_mount.h
>> +++ b/fs/xfs/xfs_mount.h
>> @@ -199,6 +199,8 @@ typedef struct xfs_mount {
>>  	struct xfs_mru_cache	*m_filestream;  /* per-mount filestream data */
>>  	struct delayed_work	m_sync_work;	/* background sync work */
>>  	struct delayed_work	m_reclaim_work;	/* background inode reclaim */
>> +	struct delayed_work	m_eofblocks_work; /* background eof blocks
>> +						     trimming */
>>  	struct work_struct	m_flush_work;	/* background inode flush */
>>  	__int64_t		m_update_flags;	/* sb flags we need to update
>>  						   on the next remount,rw */
>> diff --git a/fs/xfs/xfs_sync.c b/fs/xfs/xfs_sync.c
>> index c9e1c16..31f678a 100644
>> --- a/fs/xfs/xfs_sync.c
>> +++ b/fs/xfs/xfs_sync.c
>> @@ -532,6 +532,31 @@ xfs_flush_worker(
>>  	xfs_sync_data(mp, SYNC_TRYLOCK | SYNC_WAIT);
>>  }
>>  
>> +/*
>> + * Background scanning to trim post-EOF preallocated space. This is queued
>> + * based on the 'eofb_centisecs' tunable (5m by default).
>> + */
>> +STATIC void
>> +xfs_queue_eofblocks(
>> +	struct xfs_mount *mp)
>> +{
>> +	rcu_read_lock();
>> +	if (radix_tree_tagged(&mp->m_perag_tree, XFS_ICI_EOFBLOCKS_TAG))
>> +		queue_delayed_work(xfs_syncd_wq, &mp->m_eofblocks_work,
>> +			msecs_to_jiffies(xfs_eofb_centisecs * 10));
>> +	rcu_read_unlock();
>> +}
> 
> This will all need reworking for the new xfs_icache.c and per-mount
> workqueue structuring. Fundamentally there is nothing wrong with
> what you've done, it's just been reworked...
> 
>> +	{
>> +		.procname	= "eofb_centisecs",
> 
> Ugh. Call it something users might understand. Say
> "background_prealloc_discard_period", or something similarly
> informative...
> 

Ok. Thanks for the review.

Brian

> Cheers,
> 
> Dave.
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

      reply	other threads:[~2012-09-28 20:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-27 17:45 [PATCH v4 0/8] speculative preallocation inode tracking Brian Foster
2012-09-27 17:45 ` [PATCH v4 1/8] xfs: add EOFBLOCKS inode tagging/untagging Brian Foster
2012-09-28  7:04   ` Dave Chinner
2012-09-28 20:40     ` Brian Foster
2012-09-27 17:45 ` [PATCH v4 2/8] xfs: support a tag-based inode_ag_iterator Brian Foster
2012-09-28  7:05   ` Dave Chinner
2012-09-27 17:45 ` [PATCH v4 3/8] xfs: create helper to check whether to free eofblocks on inode Brian Foster
2012-09-28  6:59   ` Dave Chinner
2012-09-28 20:41     ` Brian Foster
2012-09-27 17:45 ` [PATCH v4 4/8] xfs: export xfs_free_eofblocks() and return EAGAIN on trylock failure Brian Foster
2012-09-28  7:00   ` Dave Chinner
2012-09-27 17:45 ` [PATCH v4 5/8] xfs: create function to scan and clear EOFBLOCKS inodes Brian Foster
2012-09-28  7:21   ` Dave Chinner
2012-09-28 20:41     ` Brian Foster
2012-09-27 17:45 ` [PATCH v4 6/8] xfs: add XFS_IOC_FREE_EOFBLOCKS ioctl Brian Foster
2012-09-28  7:25   ` Dave Chinner
2012-09-27 17:45 ` [PATCH v4 7/8] xfs: add enhanced filtering to EOFBLOCKS scan Brian Foster
2012-09-28  7:53   ` Dave Chinner
2012-09-28 20:42     ` Brian Foster
2012-09-27 17:45 ` [PATCH v4 8/8] xfs: add background scanning to clear EOFBLOCKS inodes Brian Foster
2012-09-28  8:00   ` Dave Chinner
2012-09-28 20:42     ` Brian Foster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50660BBA.2080500@redhat.com \
    --to=bfoster@redhat.com \
    --cc=david@fromorbit.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox