All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: xfs@oss.sgi.com
Subject: [PATCH 2/2] xfs: do not call xfs_bdstrat_cb in xfs_buf_iodone_callbacks
Date: Mon, 02 Jul 2012 06:00:05 -0400	[thread overview]
Message-ID: <20120702100034.921366796@bombadil.infradead.org> (raw)
In-Reply-To: 20120702100003.960640484@bombadil.infradead.org

[-- Attachment #1: xfs-kill-xfs_bdstrat_cb-1 --]
[-- Type: text/plain, Size: 2845 bytes --]

xfs_bdstrat_cb only adds a check for a shutdown filesystem over xfs_buf_iorequest,
but xfs_buf_iodone_callbacks just checked for a shut down filesystem a little
earlier.  In addition the shutdown handling in xfs_bdstrat_cb is not very suitable
for this caller.

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

---
 fs/xfs/xfs_buf.c      |   51 +++++++++++++++++++++-----------------------------
 fs/xfs/xfs_buf_item.c |    2 -
 2 files changed, 23 insertions(+), 30 deletions(-)

Index: xfs/fs/xfs/xfs_buf_item.c
===================================================================
--- xfs.orig/fs/xfs/xfs_buf_item.c	2012-06-26 23:20:22.326407387 +0200
+++ xfs/fs/xfs/xfs_buf_item.c	2012-06-26 23:20:28.766407349 +0200
@@ -954,7 +954,7 @@ xfs_buf_iodone_callbacks(
 
 		if (!XFS_BUF_ISSTALE(bp)) {
 			bp->b_flags |= XBF_WRITE | XBF_ASYNC | XBF_DONE;
-			xfs_bdstrat_cb(bp);
+			xfs_buf_iorequest(bp);
 		} else {
 			xfs_buf_relse(bp);
 		}
Index: xfs/fs/xfs/xfs_buf.c
===================================================================
--- xfs.orig/fs/xfs/xfs_buf.c	2012-06-26 23:20:23.686407379 +0200
+++ xfs/fs/xfs/xfs_buf.c	2012-06-26 23:21:40.286406924 +0200
@@ -989,27 +989,6 @@ xfs_buf_ioerror_alert(
 		(__uint64_t)XFS_BUF_ADDR(bp), func, bp->b_error, bp->b_length);
 }
 
-int
-xfs_bwrite(
-	struct xfs_buf		*bp)
-{
-	int			error;
-
-	ASSERT(xfs_buf_islocked(bp));
-
-	bp->b_flags |= XBF_WRITE;
-	bp->b_flags &= ~(XBF_ASYNC | XBF_READ | _XBF_DELWRI_Q);
-
-	xfs_bdstrat_cb(bp);
-
-	error = xfs_buf_iowait(bp);
-	if (error) {
-		xfs_force_shutdown(bp->b_target->bt_mount,
-				   SHUTDOWN_META_IO_ERROR);
-	}
-	return error;
-}
-
 /*
  * Called when we want to stop a buffer from getting written or read.
  * We attach the EIO error, muck with its flags, and call xfs_buf_ioend
@@ -1079,14 +1058,7 @@ xfs_bioerror_relse(
 	return EIO;
 }
 
-
-/*
- * All xfs metadata buffers except log state machine buffers
- * get this attached as their b_bdstrat callback function.
- * This is so that we can catch a buffer
- * after prematurely unpinning it to forcibly shutdown the filesystem.
- */
-int
+STATIC int
 xfs_bdstrat_cb(
 	struct xfs_buf	*bp)
 {
@@ -1107,6 +1079,27 @@ xfs_bdstrat_cb(
 	return 0;
 }
 
+int
+xfs_bwrite(
+	struct xfs_buf		*bp)
+{
+	int			error;
+
+	ASSERT(xfs_buf_islocked(bp));
+
+	bp->b_flags |= XBF_WRITE;
+	bp->b_flags &= ~(XBF_ASYNC | XBF_READ | _XBF_DELWRI_Q);
+
+	xfs_bdstrat_cb(bp);
+
+	error = xfs_buf_iowait(bp);
+	if (error) {
+		xfs_force_shutdown(bp->b_target->bt_mount,
+				   SHUTDOWN_META_IO_ERROR);
+	}
+	return error;
+}
+
 /*
  * Wrapper around bdstrat so that we can stop data from going to disk in case
  * we are shutting down the filesystem.  Typically user data goes thru this

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

  parent reply	other threads:[~2012-07-02 10:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-02 10:00 [PATCH 0/2] buffer caches fixes for Linux 3.5 Christoph Hellwig
2012-07-02 10:00 ` [PATCH 1/2] xfs: prevent recursion in xfs_buf_iorequest Christoph Hellwig
2012-07-03  0:27   ` Dave Chinner
2012-07-02 10:00 ` Christoph Hellwig [this message]
2012-07-03  0:28   ` [PATCH 2/2] xfs: do not call xfs_bdstrat_cb in xfs_buf_iodone_callbacks Dave Chinner
2012-07-03 16:05     ` Christoph Hellwig
2012-07-03 23:29       ` Dave Chinner
2012-07-04  5:57         ` Christoph Hellwig
2012-07-04  8:32           ` Dave Chinner
2012-07-04 15:16             ` Christoph Hellwig
2012-07-12 23:04   ` Ben Myers
2012-07-13  6:16     ` Christoph Hellwig
2012-07-13  6:24       ` [PATCH 2/2 v2] " Christoph Hellwig
2012-07-13 16:59         ` Ben Myers
2012-07-13 19:12         ` Ben Myers

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=20120702100034.921366796@bombadil.infradead.org \
    --to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.