xfs_io: actually issue 0 size writes
Quoted 42 lines · ----- "Eric Sandeen
Quoted 21 lines · Lachlan McIlroy
Quoted 19 lines · ----- "Eric Sandeen
Quoted 6 lines · Felix Blyakher
Quoted 4 lines · Eric Sandeen
While testing some stuff in
generic_write_checks()in the kernel I realized that you can't actually usexfs_ioto send a 0-byte write in. This is actually a condition worth testing:Quoted 8 lines
Quoted 5 lines
If count is zero and fd refers to a regular file, then
write()may return a failure status if one of the errors below is detected. If no errors are detected, 0 will be returned without causing any other effect.As I understand the desire to be able to issue 0 size writes from
xfs_iois to test the possibility of writing to a given fd. What kind of errors would you expect to test for?In general EFBIG or ENOSPC.
This sort of thing in
generic_write_checks():Quoted 8 lines
Quoted 8 lines
if (unlikely(*pos >= inode->i_sb->s_maxbytes)) { if (*count || *pos > inode->i_sb->s_maxbytes) { return -EFBIG; } /* zero-length writes at ->s_maxbytes are OK */ }Although I'm a little confused about why "*pos ==
s_maxbytes" isok;
Quoted 2 lines
Quoted 2 lines
I
thoughts_maxbyteswas a count/size whereas pos is an offset, soit
Quoted 1 line
Quoted 1 line
seems to me that pos ==
s_maxbytesis one past the max. Butanyway,
Quoted 3 lines
Quoted 1 line
that's mostly unrelated to the patch in this thread. :)
pos ==
s_maxbytesis only okay if count == 0 also. So even thoughwe
Quoted 1 line
are writing at the limit we are not actually going to write
anything.
Quoted 8 lines
Quoted 1 line
At s_maxbytes-1 we are allowed to write one byte and at
s_maxbyteswe
Quoted 1 line
are allowed to write nothing - literally.
I think my confusion over maxbytes is whether it's a size or an offset.
The comment says ... max size.
Yes it's a size.
Quoted 3 lines
Also in the above function it does
i_size_readon the block device - again a size.
Yes.
Quoted 3 lines
If it's a max offset you're right; if it's a max -size- then pos ==
s_maxbytesis already off the end, one past the limit.
Technically it's only off the end if you try to read something.
Quoted 7 lines
-eric
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs