2011/10/29 Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>: > On Fri, 28 Oct 2011, Felipe Balbi wrote: > >> On Fri, Oct 28, 2011 at 03:22:16PM -0400, Alan Stern wrote: >> > On Fri, 28 Oct 2011, Alan Stern wrote: >> > >> > > 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? >> > >> > I just went back and looked at the SCSI spec. The description of START >> > STOP UNIT says this: >> > >> > Targets that contain cache memory shall implicitly perform a >> > SYNCHRONIZE CACHE command for the entire medium prior to >> > executing the STOP UNIT command. >> > >> > That's pretty clear. Currently the do_start_stop() routine just calls >> > fsg_lun_close(); it looks like we should put an fsg_lun_fsync_sub() >> > call there too if the backing storage is not a regular file (and maybe >> > even if it _is_ a regular file, if we want to obey the spec strictly). >> > >> > Then there won't be any need for fsg_lun_fsync_sub() in >> > do_prevent_allow(). sounds pretty good and much clear. as i have suggested in my first reply in this thread: " suppose users use a SD card partition as back file, will we move the fsync to STOP command instead of "ALLOW MEDIUM REMOVAL"? " i agree with Alan we can do fsync for both regular file and disk partition. >> >> Makes sense to me. Care to send a patch to be queued for this -rc cycle? > > If Yuping or Barry would like to do it, that's fine with me. Otherwise > I can send a patch. > > Alan Stern -barry -- 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