On Mon, Jan 24, 2022 at 10:43:11AM -0800, Jeremy Allison via samba wrote:> On Mon, Jan 24, 2022 at 07:21:05PM +0100, Ralph Boehme wrote: > > On 1/24/22 18:39, Jeremy Allison via samba wrote: > > > No, we don't currently use O_DIRECT on Linux. > > > > > > It doesn't match to SMB2+ semantics. > > > > I think it does (SMB2_WRITEFLAG_WRITE_UNBUFFERED), but we don't yet > > implement it correctly. We check the flag and basically skip an fsync() > > done in some cases, but we don't pass it to the OS. I guess the problem > > is that in SMB the unbuffered is requested per *write* whereas we can > > only request unbuffered IO per *handle* with O_DIRECT. But I may be > > missing something. > > Oh, good catch. I missed that flag. However I think there's another > missmatch. O_DIRECT has alignment restrictions on where the > IO can be performed. I think it mandates 512 byte boundaries.FWIW, preadv2() has RWF_DSYNC and RWF_SYNC which provide O_DSYNC and O_SYNC semantics per write. Maybe one of those aligns more closely with WRITE_UNBUFFERED. Christof
On Mon, Jan 24, 2022 at 05:50:06PM -0700, Christof Schmitt wrote:> On Mon, Jan 24, 2022 at 10:43:11AM -0800, Jeremy Allison via samba wrote: > > On Mon, Jan 24, 2022 at 07:21:05PM +0100, Ralph Boehme wrote: > > > On 1/24/22 18:39, Jeremy Allison via samba wrote: > > > > No, we don't currently use O_DIRECT on Linux. > > > > > > > > It doesn't match to SMB2+ semantics. > > > > > > I think it does (SMB2_WRITEFLAG_WRITE_UNBUFFERED), but we don't yet > > > implement it correctly. We check the flag and basically skip an fsync() > > > done in some cases, but we don't pass it to the OS. I guess the problem > > > is that in SMB the unbuffered is requested per *write* whereas we can > > > only request unbuffered IO per *handle* with O_DIRECT. But I may be > > > missing something. > > > > Oh, good catch. I missed that flag. However I think there's another > > missmatch. O_DIRECT has alignment restrictions on where the > > IO can be performed. I think it mandates 512 byte boundaries. > > FWIW, preadv2() has RWF_DSYNC and RWF_SYNC which provide O_DSYNC and > O_SYNC semantics per write. Maybe one of those aligns more closely with > WRITE_UNBUFFERED.pwritev2() of course... Christof
On 1/25/22 01:50, Christof Schmitt wrote:> FWIW, preadv2() has RWF_DSYNC and RWF_SYNC which provide O_DSYNC and > O_SYNC semantics per write. Maybe one of those aligns more closely with > WRITE_UNBUFFERED.perfect! Any takers? :) Cheers! -slow -- Ralph Boehme, Samba Team https://samba.org/ SerNet Samba Team Lead https://sernet.de/en/team-samba -------------- next part -------------- A non-text attachment was scrubbed... Name: OpenPGP_signature Type: application/pgp-signature Size: 840 bytes Desc: OpenPGP digital signature URL: <http://lists.samba.org/pipermail/samba/attachments/20220125/76c36e88/OpenPGP_signature.sig>