All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Cc: Joe Thornber <ejt@redhat.com>
Subject: Re: [PATCH 07/11] [dm-thin] Commit every second to prevent too much of a position building up.
Date: Tue, 7 Feb 2012 18:00:42 -0500	[thread overview]
Message-ID: <20120207230042.GA21071@redhat.com> (raw)
In-Reply-To: <20120207165319.GA27715@redhat.com>

On Tue, Feb 07 2012 at 11:53am -0500,
Mike Snitzer <snitzer@redhat.com> wrote:

> On Thu, Feb 02 2012 at 11:39am -0500,
> Joe Thornber <ejt@redhat.com> wrote:
> 
> > ---
> >  drivers/md/dm-thin.c |   28 ++++++++++++++++++++++++++--
> >  1 files changed, 26 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
> > index 6ef03a2..19de11a 100644
> > --- a/drivers/md/dm-thin.c
> > +++ b/drivers/md/dm-thin.c
> > @@ -23,6 +23,7 @@
> >  #define DEFERRED_SET_SIZE 64
> >  #define MAPPING_POOL_SIZE 1024
> >  #define PRISON_CELLS 1024
> > +#define COMMIT_PERIOD HZ
> >  
> >  /*
> >   * The block size of the device holding pool data must be
> > @@ -498,8 +499,10 @@ struct pool {
> >  
> >  	struct workqueue_struct *wq;
> >  	struct work_struct worker;
> > +	struct delayed_work waker;
> >  
> >  	unsigned ref_count;
> > +	unsigned long last_commit_jiffies;
> >  
> >  	spinlock_t lock;
> >  	struct bio_list deferred_bios;
> > @@ -1256,6 +1259,12 @@ static void process_bio(struct thin_c *tc, struct bio *bio)
> >  	}
> >  }
> >  
> > +static int need_commit_due_to_time(struct pool *pool)
> > +{
> > +	return jiffies < pool->last_commit_jiffies ||
> > +	       jiffies > pool->last_commit_jiffies + COMMIT_PERIOD;
> > +}
> > +
> >  static void process_deferred_bios(struct pool *pool)
> >  {
> >  	unsigned long flags;
> > @@ -1297,7 +1306,7 @@ static void process_deferred_bios(struct pool *pool)
> >  	bio_list_init(&pool->deferred_flush_bios);
> >  	spin_unlock_irqrestore(&pool->lock, flags);
> >  
> > -	if (bio_list_empty(&bios))
> > +	if (bio_list_empty(&bios) && !need_commit_due_to_time(pool))
> >  		return;
> 
> Shouldn't this be:
> 
> 	if (bio_list_empty(&bios) || !need_commit_due_to_time(pool))
> 		return;
> 
> ?

Hmm, looking closer at the code it is clear that if we'd use || then the
pool->deferred_flush_bios would get dropped in the floor by the
!need_commit_due_to_time(pool) early return.

So ignore that ;)

> Also, should we make the commit interval tunable (akin to ext[34]'s
> 'commit' mount option)?  Or did you defer doing so until it proves
> worthwhile?

But this question still stands.

  reply	other threads:[~2012-02-07 23:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-02 16:39 [PATCH 00/11] Latest dm-thin patches Joe Thornber
2012-02-02 16:39 ` [PATCH 01/11] Unlock the superblock on an error path for new metadata dev creation Joe Thornber
2012-02-02 16:39 ` [PATCH 02/11] Remove redundant arg from value_ptr() Joe Thornber
2012-02-02 16:39 ` [PATCH 03/11] [PATCH 18/19] [dm-thin] [bio prison] Don't use the bi_next field for the holder of a cell Joe Thornber
2012-02-07 23:18   ` Mike Snitzer
2012-02-10 14:55     ` Joe Thornber
2012-02-10 18:03   ` [PATCH 04/12 v2] dm thin: don't " Mike Snitzer
2012-02-02 16:39 ` [PATCH 04/11] [PATCH 15/19] [dm-thin] dm_thin_remove_block() wasn't decrementing the mapped_blocks counter Joe Thornber
2012-02-02 16:39 ` [PATCH 05/11] [dm-thin] btree-remove - fix rebalancing of 3 nodes Joe Thornber
2012-02-02 16:39 ` [PATCH 06/11] Remove entries from the ref_count tree if they're no longer needed Joe Thornber
2012-02-02 16:39 ` [PATCH 07/11] [dm-thin] Commit every second to prevent too much of a position building up Joe Thornber
2012-02-07 16:53   ` Mike Snitzer
2012-02-07 23:00     ` Mike Snitzer [this message]
2012-02-10 14:48     ` Joe Thornber
2012-02-10 14:55       ` Mike Snitzer
2012-02-02 16:39 ` [PATCH 08/11] [dm-thin] Add support for external origins Joe Thornber
2012-02-02 16:39 ` [PATCH 09/11] [dm-thin] Discard support part 1 Joe Thornber
2012-02-02 16:39 ` [PATCH 10/11] [dm-thin] Add support for REQ_DISCARD Joe Thornber
2012-02-10 18:08   ` [PATCH 12/12 v2] dm thin: add discard support Mike Snitzer
2012-02-02 16:39 ` [PATCH 11/11] [dm-thin] some tidy ups of the __open_device() error path (Mike Snitzer) Joe Thornber

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=20120207230042.GA21071@redhat.com \
    --to=snitzer@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=ejt@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.