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]

 



On Fri, 28 Oct 2011, Felipe Balbi wrote:

> > > > 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();

That's more complicated than it needs to be.  Besides, if all the SCSI 
WRITE commands have FUA set and we aren't ignoring FUA, then the page 
cache will be clean already and fsync() won't take any time.

The important questions are:

	When are the right times to flush the page cache?

	Why should the MSC gadget have to worry about this in the
	first place?  That is, why doesn't the rest of the kernel
	take care of this automatically?

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

  Powered by Linux