Re: usb-storage: fsync() take too much time when handing ALLOW_MEDIUM_REMOVAL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Fri, Oct 28, 2011 at 06:18:55PM +0300, Felipe Balbi wrote:
> On Fri, Oct 28, 2011 at 10:50:04AM -0400, Alan Stern wrote:
> > On Fri, 28 Oct 2011, Felipe Balbi wrote:
> > 
> > > > I'm pretty sure Windows assumes that once a write to a removable device
> > > > completes, the data is safe. Most Windows users don't bother to "safely
> > > > eject" a thumb drive, they just yank it once the transfer is shown as
> > > > complete.
> > > 
> > > That's configurable. You can optimize for performance - which will do
> > > asynchronous writes - or you can optimize for removal - which will all
> > > SCSI Writes to be synchronous.
> > > 
> > > Commit a93917d39fc388c4761d2530af82513e2d3bf9f6 added a module parameter
> > > to ignore the FUA bit.
> > > 
> > > The point is, if FUA is set and all writes are synchronous already, do
> > > we need to fsync() again ?
> > 
> > No, we shouldn't need to.  But turn it around.  If we are ignoring FUA, 
> > can we afford not to fsync?
> 
> the fact is that we're not ignoring by default, right ? That's a module
> parameter. Which means that we could:
> 
> if (ignore_fua)
> 	fsync();

Actually it needs to two situations:

a) SCSI command doesn't have FUA set
b) Ignore FUA module parameter is set

On the above cases we need to sync, so something like:

if (!scsi_cmd->fua || ignore_fua)
	fsync();

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux