What's the "prepare_discard_fn" supposed to do?
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
Quoted 8 lines · Chris Worley
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_fnfunction.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.
Signature · 2 lines
David Woodhouse Open Source Technology Centre [email protected] Intel Corporation
Hi David,
Quoted 6 lines · David Woodhouse
It's intended to prepare the command which will be sent to the device, much like the
prepare_flush_fndoes. Seesd_prepare_flush()indrivers/scsi/sd.cfor 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.
Signature · 6 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Artem Bityutskiy
Hi David,
Quoted 6 lines · David Woodhouse
It's intended to prepare the command which will be sent to the device, much like the
prepare_flush_fndoes. Seesd_prepare_flush()indrivers/scsi/sd.cfor 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.
Quoted 3 lines
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.
Signature · 2 lines
David Woodhouse Open Source Technology Centre [email protected] Intel Corporation
Quoted 3 lines · Artem Bityutskiy
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.
Signature · 4 lines
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."