From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Cc: matthew@wil.cx, linux-kernel@vger.kernel.org,
Dave Chinner <david@fromorbit.com>
Subject: [PATCH 4/6] Replace the XFS buf iodone semaphore with a completion
Date: Thu, 26 Jun 2008 14:41:15 +1000 [thread overview]
Message-ID: <1214455277-6387-5-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1214455277-6387-1-git-send-email-david@fromorbit.com>
The xfs_buf_t b_iodonesema is really just a semaphore
that wants to be a completion. Change it to a completion
and remove the last user of the sema_t from XFS.
Signed-off-by: Dave Chinner <david@fromorbit.com>
---
fs/xfs/linux-2.6/xfs_buf.c | 6 +++---
fs/xfs/linux-2.6/xfs_buf.h | 4 ++--
fs/xfs/xfs_buf_item.c | 2 +-
fs/xfs/xfs_rw.c | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 9cc8f02..9438c90 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -253,7 +253,7 @@ _xfs_buf_initialize(
memset(bp, 0, sizeof(xfs_buf_t));
atomic_set(&bp->b_hold, 1);
- init_MUTEX_LOCKED(&bp->b_iodonesema);
+ init_completion(&bp->b_iowait);
INIT_LIST_HEAD(&bp->b_list);
INIT_LIST_HEAD(&bp->b_hash_list);
init_MUTEX_LOCKED(&bp->b_sema); /* held, no waiters */
@@ -1037,7 +1037,7 @@ xfs_buf_ioend(
xfs_buf_iodone_work(&bp->b_iodone_work);
}
} else {
- up(&bp->b_iodonesema);
+ complete(&bp->b_iowait);
}
}
@@ -1275,7 +1275,7 @@ xfs_buf_iowait(
XB_TRACE(bp, "iowait", 0);
if (atomic_read(&bp->b_io_remaining))
blk_run_address_space(bp->b_target->bt_mapping);
- down(&bp->b_iodonesema);
+ wait_for_completion(&bp->b_iowait);
XB_TRACE(bp, "iowaited", (long)bp->b_error);
return bp->b_error;
}
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h
index 29d1d4a..fe01099 100644
--- a/fs/xfs/linux-2.6/xfs_buf.h
+++ b/fs/xfs/linux-2.6/xfs_buf.h
@@ -157,7 +157,7 @@ typedef struct xfs_buf {
xfs_buf_iodone_t b_iodone; /* I/O completion function */
xfs_buf_relse_t b_relse; /* releasing function */
xfs_buf_bdstrat_t b_strat; /* pre-write function */
- struct semaphore b_iodonesema; /* Semaphore for I/O waiters */
+ struct completion b_iowait; /* queue for I/O waiters */
void *b_fspriv;
void *b_fspriv2;
void *b_fspriv3;
@@ -352,7 +352,7 @@ extern void xfs_buf_trace(xfs_buf_t *, char *, void *, void *);
#define XFS_BUF_CPSEMA(bp) (xfs_buf_cond_lock(bp) == 0)
#define XFS_BUF_VSEMA(bp) xfs_buf_unlock(bp)
#define XFS_BUF_PSEMA(bp,x) xfs_buf_lock(bp)
-#define XFS_BUF_V_IODONESEMA(bp) up(&bp->b_iodonesema);
+#define XFS_BUF_FINISH_IOWAIT(bp) complete(&bp->b_iowait);
#define XFS_BUF_SET_TARGET(bp, target) ((bp)->b_target = (target))
#define XFS_BUF_TARGET(bp) ((bp)->b_target)
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index d86ca2c..215c36d 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -1056,7 +1056,7 @@ xfs_buf_iodone_callbacks(
anyway. */
XFS_BUF_SET_BRELSE_FUNC(bp,xfs_buf_error_relse);
XFS_BUF_DONE(bp);
- XFS_BUF_V_IODONESEMA(bp);
+ XFS_BUF_FINISH_IOWAIT(bp);
}
return;
}
diff --git a/fs/xfs/xfs_rw.c b/fs/xfs/xfs_rw.c
index b0f31c0..3a82576 100644
--- a/fs/xfs/xfs_rw.c
+++ b/fs/xfs/xfs_rw.c
@@ -314,7 +314,7 @@ xfs_bioerror_relse(
* ASYNC buffers.
*/
XFS_BUF_ERROR(bp, EIO);
- XFS_BUF_V_IODONESEMA(bp);
+ XFS_BUF_FINISH_IOWAIT(bp);
} else {
xfs_buf_relse(bp);
}
--
1.5.5.4
next prev parent reply other threads:[~2008-06-26 4:40 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-26 4:41 [PATCH 0/6] Remove most users of semaphores from XFS Dave Chinner
2008-06-26 4:41 ` [PATCH 1/6] Extend completions to provide XFS object flush requirements Dave Chinner
2008-06-26 7:46 ` Christoph Hellwig
2008-06-26 11:21 ` Dave Chinner
2008-06-26 13:07 ` Christoph Hellwig
2008-06-26 13:18 ` Dave Chinner
2008-06-26 11:26 ` Matthew Wilcox
2008-06-26 11:32 ` Dave Chinner
2008-06-26 11:42 ` Matthew Wilcox
2008-06-26 12:21 ` Dave Chinner
2008-06-26 12:40 ` Matthew Wilcox
2008-06-26 12:49 ` Christoph Hellwig
2008-06-26 13:02 ` Dave Chinner
2008-06-26 20:33 ` Daniel Walker
2008-06-27 1:52 ` Dave Chinner
2008-06-27 2:24 ` Matthew Wilcox
2008-06-27 3:26 ` Daniel Walker
2008-06-27 9:15 ` Christoph Hellwig
2008-06-27 14:37 ` Daniel Walker
2008-06-26 4:41 ` [PATCH 2/6] Replace inode flush semaphore with a completion Dave Chinner
2008-06-27 2:30 ` Matthew Wilcox
2008-06-27 4:13 ` Dave Chinner
2008-06-26 4:41 ` [PATCH 3/6] Replace dquot " Dave Chinner
2008-06-26 4:41 ` Dave Chinner [this message]
2008-06-26 7:41 ` [PATCH 4/6] Replace the XFS buf iodone " Christoph Hellwig
2008-06-26 4:41 ` [PATCH 5/6] Remove the sema_t from XFS Dave Chinner
2008-06-26 4:41 ` [PATCH 6/6] Clean up stale references to semaphores Dave Chinner
2008-06-26 7:47 ` 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=1214455277-6387-5-git-send-email-david@fromorbit.com \
--to=david@fromorbit.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
--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