opensubscriber
   Find in this group all groups
 
Unknown more information…

x : xfs@oss.sgi.com 14 August 2009 • 8:56AM -0400

Re: [PATCH] xfs_io: actually issue 0 size writes
by Lachlan McIlroy

REPLY TO AUTHOR
 
REPLY TO GROUP





----- "Eric Sandeen" <sandeen@sand...> wrote:

> Felix Blyakher wrote:
> > On Aug 13, 2009, at 5:15 PM, Eric Sandeen wrote:
> >
> >> While testing some stuff in generic_write_checks() in the
> >> kernel I realized that you can't actually use xfs_io to send
> >> a 0-byte write in.  This is actually a condition worth testing:
> >>
> >>       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_io is 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():
>
>         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" is ok;
> I
> thought s_maxbytes was a count/size whereas pos is an offset, so it
> seems to me that pos == s_maxbytes is one past the max.  But anyway,
> that's mostly unrelated to the patch in this thread.  :)
pos == s_maxbytes is only okay if count == 0 also.  So even though we
are writing at the limit we are not actually going to write anything.
At s_maxbytes-1 we are allowed to write one byte and at s_maxbytes we
are allowed to write nothing - literally.

>
> -Eric
>
> > Otherwise looks good.
> >
> > Felix
>
>
> _______________________________________________
> xfs mailing list
> xfs@oss....
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss....
http://oss.sgi.com/mailman/listinfo/xfs

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.