linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* What's the "prepare_discard_fn" supposed to do?
@ 2008-10-02 13:45 Chris Worley
  2008-10-02 13:52 ` David Woodhouse
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Worley @ 2008-10-02 13:45 UTC (permalink / raw)
  To: linux-fsdevel, dwmw2

In perusing the "discard-2.6" kernel at infradead.org (great job... I
have a device I'm testing it on, and it's working), I'm unclear on
what I'm supposed to do in the prepare_discard_fn function.

It looks like, if it exists, the the discard bio gets passed to the
normal handler.  Otherwise, it seems to have no duties.  I'm guessing
it's for whatever initialization is needed for the device...  but
checking to be sure.

Thanks,

Chris

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: What's the "prepare_discard_fn" supposed to do?
  2008-10-02 13:45 What's the "prepare_discard_fn" supposed to do? Chris Worley
@ 2008-10-02 13:52 ` David Woodhouse
  2008-10-03  6:48   ` Artem Bityutskiy
  0 siblings, 1 reply; 5+ messages in thread
From: David Woodhouse @ 2008-10-02 13:52 UTC (permalink / raw)
  To: Chris Worley; +Cc: linux-fsdevel

On Thu, 2008-10-02 at 07:45 -0600, Chris Worley wrote:
> In perusing the "discard-2.6" kernel at infradead.org (great job... I
> have a device I'm testing it on, and it's working), I'm unclear on
> what I'm supposed to do in the prepare_discard_fn function.
> 
> It looks like, if it exists, the the discard bio gets passed to the
> normal handler.  Otherwise, it seems to have no duties.  I'm guessing
> it's for whatever initialization is needed for the device...  but
> checking to be sure.

It's intended to prepare the command which will be sent to the device,
much like the prepare_flush_fn does. See sd_prepare_flush() in
drivers/scsi/sd.c for an example (all the devices we've hooked up for
discard in Linux so far are virtual ones, so they don't make good
examples). I do have a real ATA drive with TRIM protocol support on its
way to me though, so I'll be looking at that some time soon.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: What's the "prepare_discard_fn" supposed to do?
  2008-10-02 13:52 ` David Woodhouse
@ 2008-10-03  6:48   ` Artem Bityutskiy
  2008-10-03  6:53     ` David Woodhouse
  2008-10-10 12:58     ` Matthew Wilcox
  0 siblings, 2 replies; 5+ messages in thread
From: Artem Bityutskiy @ 2008-10-03  6:48 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Chris Worley, linux-fsdevel

Hi David,

David Woodhouse wrote:
> It's intended to prepare the command which will be sent to the device,
> much like the prepare_flush_fn does. See sd_prepare_flush() in
> drivers/scsi/sd.c for an example (all the devices we've hooked up for
> discard in Linux so far are virtual ones, so they don't make good
> examples). I do have a real ATA drive with TRIM protocol support on its
> way to me though, so I'll be looking at that some time soon.

Sorry for my ignorance, but why "discard" is used in hard drive? What
may it improve? I've always been thinking it is only useful for SSD and
other FTL-enabled beasts.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: What's the "prepare_discard_fn" supposed to do?
  2008-10-03  6:48   ` Artem Bityutskiy
@ 2008-10-03  6:53     ` David Woodhouse
  2008-10-10 12:58     ` Matthew Wilcox
  1 sibling, 0 replies; 5+ messages in thread
From: David Woodhouse @ 2008-10-03  6:53 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: Chris Worley, linux-fsdevel

On Fri, 2008-10-03 at 09:48 +0300, Artem Bityutskiy wrote:
> Hi David,
> 
> David Woodhouse wrote:
> > It's intended to prepare the command which will be sent to the device,
> > much like the prepare_flush_fn does. See sd_prepare_flush() in
> > drivers/scsi/sd.c for an example (all the devices we've hooked up for
> > discard in Linux so far are virtual ones, so they don't make good
> > examples). I do have a real ATA drive with TRIM protocol support on its
> > way to me though, so I'll be looking at that some time soon.
> 
> Sorry for my ignorance, but why "discard" is used in hard drive? What
> may it improve? I've always been thinking it is only useful for SSD and
> other FTL-enabled beasts.

I said 'real ATA drive'. I didn't say it was magnetic.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: What's the "prepare_discard_fn" supposed to do?
  2008-10-03  6:48   ` Artem Bityutskiy
  2008-10-03  6:53     ` David Woodhouse
@ 2008-10-10 12:58     ` Matthew Wilcox
  1 sibling, 0 replies; 5+ messages in thread
From: Matthew Wilcox @ 2008-10-10 12:58 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: David Woodhouse, Chris Worley, linux-fsdevel

On Fri, Oct 03, 2008 at 09:48:39AM +0300, Artem Bityutskiy wrote:
> Sorry for my ignorance, but why "discard" is used in hard drive? What
> may it improve? I've always been thinking it is only useful for SSD and
> other FTL-enabled beasts.

If you look at the work being done in T10, it's also envisaged as being
useful for large storage arrays where you do "thin provisioning" --
eg pretend that twenty clients each have a terabyte of disc and only
buy five terabytes of disc for the array.  When they start to use four
terabytes, you'll buy some more discs for it, and nobody will ever know.

In order to make this work well, you have to know when files really have
been deleted.

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-10-10 12:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-02 13:45 What's the "prepare_discard_fn" supposed to do? Chris Worley
2008-10-02 13:52 ` David Woodhouse
2008-10-03  6:48   ` Artem Bityutskiy
2008-10-03  6:53     ` David Woodhouse
2008-10-10 12:58     ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).