From: Alex Elder <aelder@sgi.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 2/4] [PATCH 2/4] xfs: remove wrappers for read/write file operations
Date: Thu, 25 Feb 2010 14:33:12 -0600 [thread overview]
Message-ID: <1267129992.1905.24.camel@doink> (raw)
In-Reply-To: <20100217083105.GB19943@infradead.org>
On Wed, 2010-02-17 at 03:31 -0500, Christoph Hellwig wrote:
> On Wed, Feb 17, 2010 at 02:55:11PM +1100, Dave Chinner wrote:
> > You've changed a local variable "pos" which had the value
> > iocb->ki_pos to a function parameter of the same name which has a
> > different value. Given this, all the existing uses of "pos" in this
> > function need to be converted to "iocb->ki_pos" as the old
> > xfs_write() never saw the original "pos" variable passed to
> > xfs_file_aio_write().
I think the simplest explanation is that previously, the value
of "offset" passed in is simply &iocb->ki_pos, and Christoph's
changes are then simply replacing "*offset" with "iocb->ki_pos".
In any case, I'm convinced the old is equivalent to the new...
-Alex
> Oh, I should have explained this in more detail. The aio_read/aio_write
> ABI both has a pos argument and the file position in iocb->ki_pos.
> They were added for allowing aio that does partial I/O in each method
> call using retries, but we don't actually use the anywhere. Thus these
> two are always these same and we even enforce that with a
>
> BUG_ON(iocb->ki_pos != pos);
>
> in the code (both old and new). Now how does the old pos local variable
> come in play? The old code didn't want to pass the kiocb to the
> low-level xfs-write function, but as want the offset it passes a pointer
> to iocb->ki_pos, which is called offset. We take a local copy of it
> before we might start modifying it, which we call pos. pos gets updated
> early in generic_write_checks if this is an O_APPEND write, but
> otherwise stays immutable and marks the position where this write
> started, while iocb->ki_pos (aka the old offset) gets updated by
> generic_file_direct_write / generic_file_buffered_write to the new
> file position after the I/O was done.
>
> > Such as here. Actually, I'm surprised the compiler let you take
> > the address of a function parameter considering parameters may be
> > passed in registers....
>
> Taking the address of arguments is perfectly valid in C, the only thing
> you can't take addresses of are "register" variables. This code is
> the same as mm/filemap.c:__generic_file_aio_write, btw.
>
> > > - trace_xfs_file_direct_write(xip, count, *offset, ioflags);
> > > + trace_xfs_file_direct_write(ip, count, iocb->ki_pos, ioflags);
> > > ret = generic_file_direct_write(iocb, iovp,
> > > - &segs, pos, offset, count, ocount);
> > > + &nr_segs, pos, &iocb->ki_pos, count, ocount);
> >
> > But you did convert some ;)
>
> I did carefull convert all offset references to ki->ki_pos, but all
> uses of pos stay the same.
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2010-02-25 20:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-15 9:44 [PATCH 0/4] implement optimized fdatasync Christoph Hellwig
2010-02-15 9:44 ` [PATCH 1/4] [PATCH 1/4] xfs: merge xfs_lrw.c into xfs_file.c Christoph Hellwig
2010-02-17 3:36 ` Dave Chinner
2010-02-17 8:14 ` Christoph Hellwig
2010-02-15 9:44 ` [PATCH 2/4] [PATCH 2/4] xfs: remove wrappers for read/write file operations Christoph Hellwig
2010-02-17 3:55 ` Dave Chinner
2010-02-17 8:31 ` Christoph Hellwig
[not found] ` <20100217211355.GR28392@discord.disaster>
2010-02-17 22:41 ` Dave Chinner
2010-02-25 20:33 ` Alex Elder [this message]
2010-02-15 9:44 ` [PATCH 3/4] [PATCH 3/4] xfs: remove wrapper for the fsync file operation Christoph Hellwig
2010-02-17 4:09 ` Dave Chinner
2010-02-17 8:33 ` Christoph Hellwig
2010-02-15 9:44 ` [PATCH 4/4] [PATCH 4/4] xfs: implement optimized fdatasync Christoph Hellwig
2010-02-17 4:17 ` Dave Chinner
2010-02-15 21:04 ` [PATCH 0/4] " Andi Kleen
2010-02-15 21:49 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1267129992.1905.24.camel@doink \
--to=aelder@sgi.com \
--cc=hch@infradead.org \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox