Subject: Re: letting userland issue FUA writes
To: Bill Studenmund <wrstuden@netbsd.org>
From: Chuck Silvers <chuq@chuq.com>
List: tech-kern
Date: 03/15/2006 06:47:37
On Tue, Mar 14, 2006 at 11:03:20PM -0800, Bill Studenmund wrote:
> On Tue, Mar 14, 2006 at 11:41:53PM -0500, Steven M. Bellovin wrote:
> > On Tue, 14 Mar 2006 18:35:46 -0800, Bill Studenmund
> > <wrstuden@NetBSD.org> wrote:
> > 
> > > I'm interested in adding infrastructure so that applications can issue 
> > > writes that have the FUA (Force Unit Access) bit set. SCSI CDBs handle 
> > > this, as do some RAID cards.
> > > 
> > > The main question I have is what kind of user-level interfaces exist for 
> > > this? I certainly could cook up a new system call, but I would much rather 
> > > use prior art. My simplistic attempt at googling for this failed. Does 
> > > anyone else have suggestions?

are you intending this for regular files or raw disk devices or both?


> > > Given the systemcall interface, driving it through the kernel isn't hard. 
> > > A flag here and a flag there, and it's set.
> > 
> > Given that it pertains to a file descriptor, shouldn't it be an ioctl?
> 
> What I really want is to be able to issue some writes with FUA set and 
> some with FUA cleared.
> 
> If for instance you are implementing a SCSI device in software (say an 
> iSCSI target), you do not know before hand if you are going to get FUA-set 
> or FUA-cleared writes.
> 
> However it probably should be good to have a descriptor-level flag, so 
> that things like a database can just get FUA for all writes.
> 
> Such a thing wouldn't be hard, as all writes pile into dofilewrite() and 
> dofilewritev() now. So they, or vn_write(), could just set the flag if 
> requested.


this sounds like direct I/O, which I've talked about before (and which
I am just getting back to looking at recently ).  a new O_DIRECT open flag
on regular files will mean that the read/write should go directly from
disk to the application's address space without going through the
page cache.  if the new behaviour you're talking about it just for
raw disk devices, then we could interpret that flag to mean FUA on
VCHR vnodes.  or are you talking about FUA with regular files?

-Chuck