diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-07-20 03:51:16 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-07-26 14:16:52 -0400 |
commit | 939d723b721eef71060201738653a73443ff4510 (patch) | |
tree | 3965391cebe9f1e0c1acb0b394c50c1b83312aa3 /fs/xfs/linux-2.6/xfs_buf.c | |
parent | a64afb057b607c04383ab5fb53c51421ba18c434 (diff) |
xfs: kill the b_strat callback in xfs_buf
The b_strat callback is used by xfs_buf_iostrategy to perform additional
checks before submitting a buffer. It is used in xfs_bwrite and when
writing out delayed buffers. In xfs_bwrite it we can de-virtualize the
call easily as b_strat is set a few lines above the call to
xfs_buf_iostrategy. For the delayed buffers the rationale is a bit
more complicated:
- there are three callers of xfs_buf_delwri_queue, which places buffers
on the delwri list:
(1) xfs_bdwrite - this sets up b_strat, so it's fine
(2) xfs_buf_iorequest. None of the callers can have XBF_DELWRI set:
- xlog_bdstrat is only used for log buffers, which are never delwri
- _xfs_buf_read explicitly clears the delwri flag
- xfs_buf_iodone_work retries log buffers only
- xfsbdstrat - only used for reads, superblock writes without the
delwri flag, log I/O and file zeroing with explicitly allocated
buffers.
- xfs_buf_iostrategy - only calls xfs_buf_iorequest if b_strat is
not set
(3) xfs_buf_unlock
- only puts the buffer on the delwri list if the DELWRI flag is
already set. The DELWRI flag is only ever set in xfs_bwrite,
xfs_buf_iodone_callbacks, or xfs_trans_log_buf. For
xfs_buf_iodone_callbacks and xfs_trans_log_buf we require
an initialized buf item, which means b_strat was set to
xfs_bdstrat_cb in xfs_buf_item_init.
Conclusion: we can just get rid of the callback and replace it with
explicit calls to xfs_bdstrat_cb.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_buf.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index f4d4e708a8d6..ea79072f5210 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -987,13 +987,12 @@ xfs_bwrite( | |||
987 | { | 987 | { |
988 | int error; | 988 | int error; |
989 | 989 | ||
990 | bp->b_strat = xfs_bdstrat_cb; | ||
991 | bp->b_mount = mp; | 990 | bp->b_mount = mp; |
992 | bp->b_flags |= XBF_WRITE; | 991 | bp->b_flags |= XBF_WRITE; |
993 | bp->b_flags &= ~(XBF_ASYNC | XBF_READ); | 992 | bp->b_flags &= ~(XBF_ASYNC | XBF_READ); |
994 | 993 | ||
995 | xfs_buf_delwri_dequeue(bp); | 994 | xfs_buf_delwri_dequeue(bp); |
996 | xfs_buf_iostrategy(bp); | 995 | xfs_bdstrat_cb(bp); |
997 | 996 | ||
998 | error = xfs_buf_iowait(bp); | 997 | error = xfs_buf_iowait(bp); |
999 | if (error) | 998 | if (error) |
@@ -1009,7 +1008,6 @@ xfs_bdwrite( | |||
1009 | { | 1008 | { |
1010 | trace_xfs_buf_bdwrite(bp, _RET_IP_); | 1009 | trace_xfs_buf_bdwrite(bp, _RET_IP_); |
1011 | 1010 | ||
1012 | bp->b_strat = xfs_bdstrat_cb; | ||
1013 | bp->b_mount = mp; | 1011 | bp->b_mount = mp; |
1014 | 1012 | ||
1015 | bp->b_flags &= ~XBF_READ; | 1013 | bp->b_flags &= ~XBF_READ; |
@@ -1044,7 +1042,6 @@ xfs_bioerror( | |||
1044 | XFS_BUF_UNDONE(bp); | 1042 | XFS_BUF_UNDONE(bp); |
1045 | XFS_BUF_STALE(bp); | 1043 | XFS_BUF_STALE(bp); |
1046 | 1044 | ||
1047 | XFS_BUF_CLR_BDSTRAT_FUNC(bp); | ||
1048 | xfs_biodone(bp); | 1045 | xfs_biodone(bp); |
1049 | 1046 | ||
1050 | return EIO; | 1047 | return EIO; |
@@ -1074,7 +1071,6 @@ xfs_bioerror_relse( | |||
1074 | XFS_BUF_DONE(bp); | 1071 | XFS_BUF_DONE(bp); |
1075 | XFS_BUF_STALE(bp); | 1072 | XFS_BUF_STALE(bp); |
1076 | XFS_BUF_CLR_IODONE_FUNC(bp); | 1073 | XFS_BUF_CLR_IODONE_FUNC(bp); |
1077 | XFS_BUF_CLR_BDSTRAT_FUNC(bp); | ||
1078 | if (!(fl & XBF_ASYNC)) { | 1074 | if (!(fl & XBF_ASYNC)) { |
1079 | /* | 1075 | /* |
1080 | * Mark b_error and B_ERROR _both_. | 1076 | * Mark b_error and B_ERROR _both_. |
@@ -1869,7 +1865,7 @@ xfsbufd( | |||
1869 | struct xfs_buf *bp; | 1865 | struct xfs_buf *bp; |
1870 | bp = list_first_entry(&tmp, struct xfs_buf, b_list); | 1866 | bp = list_first_entry(&tmp, struct xfs_buf, b_list); |
1871 | list_del_init(&bp->b_list); | 1867 | list_del_init(&bp->b_list); |
1872 | xfs_buf_iostrategy(bp); | 1868 | xfs_bdstrat_cb(bp); |
1873 | count++; | 1869 | count++; |
1874 | } | 1870 | } |
1875 | if (count) | 1871 | if (count) |
@@ -1916,7 +1912,7 @@ xfs_flush_buftarg( | |||
1916 | bp->b_flags &= ~XBF_ASYNC; | 1912 | bp->b_flags &= ~XBF_ASYNC; |
1917 | list_add(&bp->b_list, &wait_list); | 1913 | list_add(&bp->b_list, &wait_list); |
1918 | } | 1914 | } |
1919 | xfs_buf_iostrategy(bp); | 1915 | xfs_bdstrat_cb(bp); |
1920 | } | 1916 | } |
1921 | 1917 | ||
1922 | if (wait) { | 1918 | if (wait) { |