public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] xfs: flag all buffers as metadata
       [not found] <20110726150633.GA17400@infradead.org>
@ 2011-07-26 15:06 ` Christoph Hellwig
  2011-07-26 22:38   ` Alex Elder
  2011-07-26 15:07 ` [PATCH 2/3] xfs: prevent against ioend livelocks in xfs_file_fsync Christoph Hellwig
  2011-07-26 15:07 ` [PATCH 3/3] xfs: optimize the negative xattr caching Christoph Hellwig
  2 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2011-07-26 15:06 UTC (permalink / raw)
  To: xfs

Now that REQ_META bios aren't treated specially in the CFQ I/O schedule
anymore, we can tag all buffers as metadata to make blktrace traces more
meaningful.  Note that we use buffers also to zero out partial blocks
in the preallocation / hole punching code, and while they operate on
data blocks the zeros written certainly aren't data.  I think this case
is borderline metadata enough to not bother special casing it.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/xfs/linux-2.6/xfs_buf.c
===================================================================
--- linux-2.6.orig/fs/xfs/linux-2.6/xfs_buf.c	2011-07-25 23:50:03.288230279 +0200
+++ linux-2.6/fs/xfs/linux-2.6/xfs_buf.c	2011-07-25 23:50:22.208230167 +0200
@@ -1224,6 +1224,9 @@ _xfs_buf_ioapply(
 		rw = READ;
 	}
 
+	/* we only use the buffer cache for meta-data */
+	rw |= REQ_META;
+
 next_chunk:
 	atomic_inc(&bp->b_io_remaining);
 	nr_pages = BIO_MAX_SECTORS >> (PAGE_SHIFT - BBSHIFT);

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

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

* [PATCH 2/3] xfs: prevent against ioend livelocks in xfs_file_fsync
       [not found] <20110726150633.GA17400@infradead.org>
  2011-07-26 15:06 ` [PATCH 1/3] xfs: flag all buffers as metadata Christoph Hellwig
@ 2011-07-26 15:07 ` Christoph Hellwig
  2011-07-26 22:39   ` Alex Elder
  2011-07-26 15:07 ` [PATCH 3/3] xfs: optimize the negative xattr caching Christoph Hellwig
  2 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2011-07-26 15:07 UTC (permalink / raw)
  To: xfs

We need to take some locks to prevent new ioends from coming in when we wait
for all existing ones to go away.  Up to Linux 3.0 that was done using the
i_mutex held by the VFS fsync code, but now that we are called without
it we need to take care of it ourselves.  Use the I/O lock instead of
i_mutex just like we do in other places.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/xfs/linux-2.6/xfs_file.c
===================================================================
--- linux-2.6.orig/fs/xfs/linux-2.6/xfs_file.c	2011-07-25 23:50:35.081563423 +0200
+++ linux-2.6/fs/xfs/linux-2.6/xfs_file.c	2011-07-25 23:51:18.098229833 +0200
@@ -149,7 +149,9 @@ xfs_file_fsync(
 
 	xfs_iflags_clear(ip, XFS_ITRUNCATED);
 
+	xfs_ilock(ip, XFS_IOLOCK_SHARED);
 	xfs_ioend_wait(ip);
+	xfs_iunlock(ip, XFS_IOLOCK_SHARED);
 
 	if (mp->m_flags & XFS_MOUNT_BARRIER) {
 		/*

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

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

* [PATCH 3/3] xfs: optimize the negative xattr caching
       [not found] <20110726150633.GA17400@infradead.org>
  2011-07-26 15:06 ` [PATCH 1/3] xfs: flag all buffers as metadata Christoph Hellwig
  2011-07-26 15:07 ` [PATCH 2/3] xfs: prevent against ioend livelocks in xfs_file_fsync Christoph Hellwig
@ 2011-07-26 15:07 ` Christoph Hellwig
  2011-07-26 22:39   ` Alex Elder
  2 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2011-07-26 15:07 UTC (permalink / raw)
  To: xfs

Since the addition of file capabilities every write needs to read xattrs to
check if we have any capabilities to clear.  In Linux 3.0 Andi Kleen added
a flag to cache the fact that we do not have any attributes on an inode.
Make sure to already mark a file as not having any attributes when reading
it from disk in case it doesn't even have an attribute fork.  Based on an
earlier patch from Andi Kleen.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/xfs/linux-2.6/xfs_iops.c
===================================================================
--- linux-2.6.orig/fs/xfs/linux-2.6/xfs_iops.c	2011-07-25 23:49:23.011563852 +0200
+++ linux-2.6/fs/xfs/linux-2.6/xfs_iops.c	2011-07-25 23:49:50.281563691 +0200
@@ -1194,9 +1194,14 @@ xfs_setup_inode(
 		break;
 	}
 
-	/* if there is no attribute fork no ACL can exist on this inode */
-	if (!XFS_IFORK_Q(ip))
+	/*
+	 * If there is no attribute fork no ACL can exist on this inode,
+	 * and it can't have any file capabilities attached to it either.
+	 */
+	if (!XFS_IFORK_Q(ip)) {
+		inode_has_no_xattr(inode);
 		cache_no_acl(inode);
+	}
 
 	xfs_iflags_clear(ip, XFS_INEW);
 	barrier();

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

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

* Re: [PATCH 1/3] xfs: flag all buffers as metadata
  2011-07-26 15:06 ` [PATCH 1/3] xfs: flag all buffers as metadata Christoph Hellwig
@ 2011-07-26 22:38   ` Alex Elder
  2011-07-26 22:40     ` Christoph Hellwig
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Elder @ 2011-07-26 22:38 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Tue, 2011-07-26 at 11:06 -0400, Christoph Hellwig wrote: 
> Now that REQ_META bios aren't treated specially in the CFQ I/O schedule
> anymore, we can tag all buffers as metadata to make blktrace traces more
> meaningful.  Note that we use buffers also to zero out partial blocks
> in the preallocation / hole punching code, and while they operate on
> data blocks the zeros written certainly aren't data.  I think this case
> is borderline metadata enough to not bother special casing it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

This looks good.  I plan to re-base the xfs master branch
after 3.1-rc1 is out, so I'll wait until after that to
commit this (and the others in this series).

If you want me to do something different, let me know.

Reviewed-by: Alex Elder <aelder@sgi.com>



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

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

* Re: [PATCH 2/3] xfs: prevent against ioend livelocks in xfs_file_fsync
  2011-07-26 15:07 ` [PATCH 2/3] xfs: prevent against ioend livelocks in xfs_file_fsync Christoph Hellwig
@ 2011-07-26 22:39   ` Alex Elder
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Elder @ 2011-07-26 22:39 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Tue, 2011-07-26 at 11:07 -0400, Christoph Hellwig wrote:
> We need to take some locks to prevent new ioends from coming in when we wait
> for all existing ones to go away.  Up to Linux 3.0 that was done using the
> i_mutex held by the VFS fsync code, but now that we are called without
> it we need to take care of it ourselves.  Use the I/O lock instead of
> i_mutex just like we do in other places.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good.

Reviewed-by: Alex Elder <aelder@sgi.com>


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

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

* Re: [PATCH 3/3] xfs: optimize the negative xattr caching
  2011-07-26 15:07 ` [PATCH 3/3] xfs: optimize the negative xattr caching Christoph Hellwig
@ 2011-07-26 22:39   ` Alex Elder
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Elder @ 2011-07-26 22:39 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Tue, 2011-07-26 at 11:07 -0400, Christoph Hellwig wrote:
> Since the addition of file capabilities every write needs to read xattrs to
> check if we have any capabilities to clear.  In Linux 3.0 Andi Kleen added
> a flag to cache the fact that we do not have any attributes on an inode.
> Make sure to already mark a file as not having any attributes when reading
> it from disk in case it doesn't even have an attribute fork.  Based on an
> earlier patch from Andi Kleen.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good to me.

Reviewed-by: Alex Elder <aelder@sgi.com>


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

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

* Re: [PATCH 1/3] xfs: flag all buffers as metadata
  2011-07-26 22:38   ` Alex Elder
@ 2011-07-26 22:40     ` Christoph Hellwig
  2011-07-26 22:41       ` Alex Elder
  0 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2011-07-26 22:40 UTC (permalink / raw)
  To: Alex Elder; +Cc: Christoph Hellwig, xfs

On Tue, Jul 26, 2011 at 05:38:55PM -0500, Alex Elder wrote:
> On Tue, 2011-07-26 at 11:06 -0400, Christoph Hellwig wrote: 
> > Now that REQ_META bios aren't treated specially in the CFQ I/O schedule
> > anymore, we can tag all buffers as metadata to make blktrace traces more
> > meaningful.  Note that we use buffers also to zero out partial blocks
> > in the preallocation / hole punching code, and while they operate on
> > data blocks the zeros written certainly aren't data.  I think this case
> > is borderline metadata enough to not bother special casing it.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> This looks good.  I plan to re-base the xfs master branch
> after 3.1-rc1 is out, so I'll wait until after that to
> commit this (and the others in this series).

I'd prefer to get it out to Linus ASAP after some review.  Just
committing it to for-linus for now and later rebasing master on top
should do fine for that.

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

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

* Re: [PATCH 1/3] xfs: flag all buffers as metadata
  2011-07-26 22:40     ` Christoph Hellwig
@ 2011-07-26 22:41       ` Alex Elder
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Elder @ 2011-07-26 22:41 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Tue, 2011-07-26 at 18:40 -0400, Christoph Hellwig wrote:
> On Tue, Jul 26, 2011 at 05:38:55PM -0500, Alex Elder wrote:
> > On Tue, 2011-07-26 at 11:06 -0400, Christoph Hellwig wrote: 
> > > Now that REQ_META bios aren't treated specially in the CFQ I/O schedule
> > > anymore, we can tag all buffers as metadata to make blktrace traces more
> > > meaningful.  Note that we use buffers also to zero out partial blocks
> > > in the preallocation / hole punching code, and while they operate on
> > > data blocks the zeros written certainly aren't data.  I think this case
> > > is borderline metadata enough to not bother special casing it.
> > > 
> > > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > 
> > This looks good.  I plan to re-base the xfs master branch
> > after 3.1-rc1 is out, so I'll wait until after that to
> > commit this (and the others in this series).
> 
> I'd prefer to get it out to Linus ASAP after some review.  Just
> committing it to for-linus for now and later rebasing master on top
> should do fine for that.

OK, fine with me.  I'll get that process started this evening.

					-Alex

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

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

end of thread, other threads:[~2011-07-26 22:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20110726150633.GA17400@infradead.org>
2011-07-26 15:06 ` [PATCH 1/3] xfs: flag all buffers as metadata Christoph Hellwig
2011-07-26 22:38   ` Alex Elder
2011-07-26 22:40     ` Christoph Hellwig
2011-07-26 22:41       ` Alex Elder
2011-07-26 15:07 ` [PATCH 2/3] xfs: prevent against ioend livelocks in xfs_file_fsync Christoph Hellwig
2011-07-26 22:39   ` Alex Elder
2011-07-26 15:07 ` [PATCH 3/3] xfs: optimize the negative xattr caching Christoph Hellwig
2011-07-26 22:39   ` Alex Elder

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