public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* Couple of code comments
@ 2007-07-25  1:59 Michael Nishimoto
  2007-07-25  3:03 ` David Chinner
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Nishimoto @ 2007-07-25  1:59 UTC (permalink / raw)
  To: XFS Mailing List

Hi,

I've got a couple of code comments.  In xfs_write, there is a
call to bhv_vop_flushinval_pages().  It appears that this function call
is not needed because the call to generic_file_direct_write() done
later in xfs_write does the same work.

generic_file_direct_write -> generic_file_direct_IO ->
(filemap_write_and_wait + invalidate_inode_pages2_range)

bhv_vop_flushinval_pages -> fs_flushinval_pages ->
(filemap_write_and_wait + truncate_inode_pages)

The code isn't exactly the same, but it appears to do the same work.

Also, within xfs_swap_extents() the code fixes up on-disk inode block
counts, but doesn't change the block counts for the Linux inode.

Comments?

    Michael

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Couple of code comments
  2007-07-25  1:59 Couple of code comments Michael Nishimoto
@ 2007-07-25  3:03 ` David Chinner
  0 siblings, 0 replies; 2+ messages in thread
From: David Chinner @ 2007-07-25  3:03 UTC (permalink / raw)
  To: Michael Nishimoto; +Cc: XFS Mailing List

On Tue, Jul 24, 2007 at 06:59:53PM -0700, Michael Nishimoto wrote:
> Hi,
> 
> I've got a couple of code comments.  In xfs_write, there is a
> call to bhv_vop_flushinval_pages().  It appears that this function call
> is not needed because the call to generic_file_direct_write() done
> later in xfs_write does the same work.
> 
> generic_file_direct_write -> generic_file_direct_IO ->
> (filemap_write_and_wait + invalidate_inode_pages2_range)
> 
> bhv_vop_flushinval_pages -> fs_flushinval_pages ->
> (filemap_write_and_wait + truncate_inode_pages)

Similar, but seeing we call generic_file_direct_write() without the
i_mutex held and we don't use the generic direct I/O path locking or
flushes (i.e in __blockdev_direct_IO()), we've got to do this flush
somewhere with the i_mutex held....

That being said, xfs_write() is an utter mess and could do
with a major cleanup.

> The code isn't exactly the same, but it appears to do the same work.

Locking is the key difference.

> Also, within xfs_swap_extents() the code fixes up on-disk inode block
> counts, but doesn't change the block counts for the Linux inode.

Patch, please. ;)

Cheers,

Dave.
-- 
Dave Chinner
Principal Engineer
SGI Australian Software Group

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-25  3:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-25  1:59 Couple of code comments Michael Nishimoto
2007-07-25  3:03 ` David Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox