All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Czerner <lczerner@redhat.com>
To: Kyungmin Park <kmpark@infradead.org>
Cc: Chris Mason <chris.mason@oracle.com>,
	Lukas Czerner <lczerner@redhat.com>,
	Christoph Hellwig <hch@infradead.org>,
	Mark Lord <kernel@teksavvy.com>,
	James Bottomley <james.bottomley@suse.de>,
	Matthew Wilcox <matthew@wil.cx>, Josef Bacik <josef@redhat.com>,
	tytso <tytso@mit.edu>, linux-ext4 <linux-ext4@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	sandeen <sandeen@redhat.com>, Dave Chinner <dchinner@redhat.com>
Subject: Re: [PATCH 1/2] fs: Do not dispatch FITRIM through separate super_operation
Date: Thu, 2 Jun 2011 10:14:35 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1106020953510.3931@dhcp-27-109.brq.redhat.com> (raw)
In-Reply-To: <BANLkTimkn7ZVAUJw6NfWVMECfe+C+82i+g@mail.gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 3812 bytes --]

On Thu, 2 Jun 2011, Kyungmin Park wrote:

> On Wed, Dec 8, 2010 at 1:52 AM, Chris Mason <chris.mason@oracle.com> wrote:
> > Excerpts from Christoph Hellwig's message of 2010-12-07 04:27:49 -0500:
> >> On Fri, Nov 19, 2010 at 10:21:35AM -0500, Mark Lord wrote:
> >> > >I really hate to rely on this third party hearsay (from all sides), and
> >> > >have implement TRIM support in qemu now.  I'll soon install win7 and
> >> > >will check out the TRIM patters myself.
> >> >
> >> > Excellent!
> >>
> >> I did a Windows 7 installation under qemu today, and the result is:
> >
> > Great, thanks for testing this.
> >
> >>
> >>  - it TRIMs the whole device early during the installation
> >>  - after that I see a constant stream of small trims during the
> >>    installation.  It's using lots of non-contiguous ranges in a single
> >>    TRIM command, with sizes down to 8 sectors (4k) for a single range.
> >>  - after installation there's is some background-trimming going on
> >>    even when doing no user interaction with the VM at all.
> 
> Hi Lukas,
> 
> Now FITRIM is based on user interaction. So how about to implement the
> AUTO batched discard at kernel level?
> Idea is same as windows, make a single thread and iterate the
> superblocks and call the trim.
> 
> here's pseudo codes.
> 
> 1. generate the trim thread.
> 2. iterate the superblocks by iterate_supers() at fs/super.c
> 3. check the queue which support the discard feature or not.
> blk_queue_discard(q)
> 4. wait on events
> 5. call the sb->trim (need to re-introduce it)
> 
> The difficult things are how to define the events and how to trigger
> the trim thread.
> e.g., notified from block layer, called from filesystem and so on.
> 
> How do you think?

Hi Kyungmin,

generally I think this is a good idea and I thought about it as well.
However I also think that we might want to wait for the FITRIM and
discard supported devices to settle down to see how it performs and if
frequently calling discard on big chunks of the device does not have
some unwanted consequences (as Dave Chinner pointed out in a different
thread, that this automations usually do).

Regarding events, filesystem might watch amount of data written to it
(and it usually do right now) and trigger the event when it exceeds,
let's say 50% of the fs size and zero the counter. The downside of this
is that it is not controlled behaviour hence we'll end up with
unpredictable behaviour of the filesystem in the long term.

The solution might be (and it is something I want to look into)
infrastructure to determine size of the queue to the device from within
the filesystem (or vfs) so we can tell when it is busy and we want to wait,
or when it is doing nothing and we can discard.

Also per filesystem, or per device, control will be needed, so we can
selectively turn it on and off. But as I said I am not sure that this is
the best idea to do it right now, but others might have different
opinion.

Thanks!
-Lukas

> 
> Thank you,
> Kyungmin Park
> 
> >>  - removing files leads to an instant stream of TRIMs, again vectored
> >>    and of all sizes down to 4k.  Note that the TRIMs are a lot more
> >>    instant than even with btrfs and -o discard, which delays most
> >>    TRIMs until doing a sync.
> >
> > Btrfs will do some small trims right when the block is freed, especially
> > in fsync heavy workloads but this is a suboptimal thing I want to fix.
> >
> > The code tries to gather a whole transaction worth of trims and do them
> > after the commit is done.
> >
> > -chris
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/
> >
> 

-- 

  reply	other threads:[~2011-06-02  8:15 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-18  7:36 [PATCH 1/2] fs: Do not dispatch FITRIM through separate super_operation Lukas Czerner
2010-11-18  7:36 ` [PATCH 2/2] ext4: Add EXT4_IOC_TRIM ioctl to handle batched discard Lukas Czerner
2010-11-19 16:19   ` Ted Ts'o
2010-11-19 16:26     ` Lukas Czerner
2010-11-20  1:37       ` Ted Ts'o
2010-11-18 13:06 ` [PATCH 1/2] fs: Do not dispatch FITRIM through separate super_operation Matthew Wilcox
2010-11-18 13:48   ` Josef Bacik
2010-11-18 14:19     ` Matthew Wilcox
2010-11-18 14:29       ` Christoph Hellwig
2010-11-18 17:19         ` James Bottomley
2010-11-18 17:22           ` Jeff Moyer
2010-11-18 17:41             ` James Bottomley
2010-11-18 20:04               ` Greg Freemyer
2010-11-18 20:04                 ` Greg Freemyer
2010-11-18 21:42                 ` Mark Lord
2010-11-18 21:44                 ` Mark Lord
2010-11-18 21:50                   ` James Bottomley
2010-11-18 22:07                     ` Mark Lord
2010-11-19  1:33                       ` Ted Ts'o
2010-11-19  3:44                         ` Mark Lord
2010-11-19  3:44                         ` Mark Lord
2010-11-19  3:44                           ` Mark Lord
2010-11-19 13:58                           ` Jeff Moyer
2010-11-18 23:52                   ` Martin K. Petersen
2010-11-19  0:34                     ` Mark Lord
2010-11-19  1:16                       ` Greg Freemyer
2010-11-19  1:16                         ` Greg Freemyer
2010-11-19 11:55                         ` Christoph Hellwig
2010-11-19 14:01                           ` Mark Lord
2010-11-19 14:06                             ` Christoph Hellwig
2010-11-19 14:48                               ` Mark Lord
2010-11-19 14:54                                 ` Christoph Hellwig
2010-11-19 15:24                                   ` Mark Lord
2010-11-19 15:34                                     ` Christoph Hellwig
2010-11-19 16:20                           ` Greg Freemyer
2010-11-19 16:38                             ` Christoph Hellwig
2010-11-19 18:06                               ` Lukas Czerner
2010-11-19 18:10                                 ` Lukas Czerner
2010-11-19 18:14                                   ` Lukas Czerner
2010-11-19 19:29                                 ` Chris Mason
2010-11-19  1:49                       ` Martin K. Petersen
2010-11-19  3:42                         ` Mark Lord
2010-11-18 18:05             ` Jamie Lokier
2010-11-18 19:32               ` Markus Trippelsdorf
2010-11-18 21:45                 ` Mark Lord
2010-11-18 21:50                   ` Markus Trippelsdorf
2010-11-18 22:09                     ` Mark Lord
2010-11-18 17:35           ` Lukas Czerner
2010-11-19 12:16             ` Steven Whitehouse
2010-11-19 13:53               ` Mark Lord
2010-11-19 14:02                 ` Ted Ts'o
2010-11-19 14:10                   ` Christoph Hellwig
2010-11-19 14:10                   ` Christoph Hellwig
2010-11-19 14:10                   ` Christoph Hellwig
2010-11-19 15:37                     ` Ted Ts'o
2010-11-19 15:50                       ` Christoph Hellwig
2010-11-19 15:50                       ` Christoph Hellwig
2010-11-19 15:50                         ` Christoph Hellwig
2010-11-19 16:16                         ` Ted Ts'o
2010-11-19 14:50                   ` Mark Lord
2010-11-19 14:50                   ` Mark Lord
2010-11-19 14:50                     ` Mark Lord
2010-11-19 15:35                   ` Mark Lord
2010-11-19 15:35                   ` Mark Lord
2010-11-19 15:35                     ` Mark Lord
2010-11-19 15:44                     ` Lukas Czerner
2010-11-19 16:30                       ` Ted Ts'o
2010-11-19 22:49                         ` Mark Lord
2010-11-19 22:49                           ` Mark Lord
2010-11-19 22:49                         ` Mark Lord
2010-11-25  2:48                         ` Mark Lord
2010-11-25  2:48                         ` Mark Lord
2010-11-25  2:48                           ` Mark Lord
2010-11-25  4:23                           ` Martin K. Petersen
2010-11-25 14:44                             ` Mark Lord
2010-11-25  4:41                           ` Greg Freemyer
2010-11-25  4:41                             ` Greg Freemyer
2010-11-25 14:53                             ` Mark Lord
2010-11-25 16:24                               ` Greg Freemyer
2010-11-25 16:24                                 ` Greg Freemyer
2010-11-26 13:49                                 ` Mark Lord
2010-11-26 14:00                                   ` Lukas Czerner
2010-11-18 17:55           ` Chris Mason
2010-12-03 18:24             ` Ric Wheeler
2010-11-18 21:37           ` Mark Lord
2010-11-19 11:09             ` Christoph Hellwig
2010-11-19 13:54               ` Mark Lord
2010-11-19 14:40             ` Chris Mason
2010-11-19 14:53               ` Mark Lord
2010-11-19 14:57                 ` Christoph Hellwig
2010-11-19 15:21                   ` Mark Lord
2010-12-07  9:27                     ` Christoph Hellwig
2010-12-07 16:52                       ` Chris Mason
2011-06-02  4:52                         ` Kyungmin Park
2011-06-02  8:14                           ` Lukas Czerner [this message]
2011-06-03  2:06                           ` Dave Chinner
2011-06-03  2:06                             ` Dave Chinner
2011-06-03  4:25                             ` Kyungmin Park
2011-06-03  4:25                               ` Kyungmin Park
2010-11-19 15:30                   ` Mark Lord
2010-11-21 19:07                 ` Valdis.Kletnieks
2010-11-21 20:20                   ` James Bottomley
2010-11-18 14:31       ` Josef Bacik
2010-11-18 14:36         ` Tao Ma
2010-11-19 15:41 ` Ted Ts'o
2010-11-19 15:50   ` Christoph Hellwig

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=alpine.LFD.2.00.1106020953510.3931@dhcp-27-109.brq.redhat.com \
    --to=lczerner@redhat.com \
    --cc=chris.mason@oracle.com \
    --cc=dchinner@redhat.com \
    --cc=hch@infradead.org \
    --cc=james.bottomley@suse.de \
    --cc=josef@redhat.com \
    --cc=kernel@teksavvy.com \
    --cc=kmpark@infradead.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=sandeen@redhat.com \
    --cc=tytso@mit.edu \
    /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.