Re: O_DIRECT foolish question

Bruno Diniz de Paula (diniz@cs.rutgers.edu)
12 Feb 2003 19:36:19 -0500


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-22990-1045096624-0001-2
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Wed, 2003-02-12 at 19:13, Chris Wedgwood wrote:
> If I had to guess, write should work more or less the same as reads
> (ie. I should be able to write aligned-but-smaller-than-page-sized
> blocks to the end of files).
>=20
> Testing this however shows this is *not* the case.

This is not the case, I have also tested here and the file written has
n*block_size always. The problem with writing is that we can't sign to
the kernel that the actual data has finished and from that point on it
should zero-fill the bytes. And what is worse, the information about the
actual size is lost, since the write syscall will store what is passed
on the 3rd argument in the inode (field st_size of stat). This means
that after writing using O_DIRECT we can't read data correctly anymore.
The exception is when we write together with the data information about
the actual size and process disregarding information from stat, for
instance.

Well, I am sure I am completely wrong because this doesn't make any
sense for me. Someone that has already dealt with this and can bring a
light to the discussion?

Thanks,

Bruno.

>=20
> Now, this *might* actually be the right thing to do ... if we allow
> 'small writes' how do we deal with larger writes once the file-write
> position is messed up?
>=20
> Heh... tricky stuff. Though required.
>=20
>=20
>=20
> --cw
--=20
Bruno Diniz de Paula <diniz@cs.rutgers.edu>
Rutgers University

--=_courier-22990-1045096624-0001-2
Content-Type: application/pgp-signature; name="signature.asc"
Content-Transfer-Encoding: 7bit
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQA+SuiDZGORSF4wrt8RAtQcAJ9PsNe6KNX1hN1YnztR09m4DmUFDQCdEvf+
Ye7eR23JIJTjapBy0EZbwsY=
=RGGQ
-----END PGP SIGNATURE-----

--=_courier-22990-1045096624-0001-2--