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.h | |
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.h')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.h | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h index 814f9e83b516..d072e5ff923b 100644 --- a/fs/xfs/linux-2.6/xfs_buf.h +++ b/fs/xfs/linux-2.6/xfs_buf.h | |||
@@ -187,7 +187,6 @@ typedef struct xfs_buf { | |||
187 | atomic_t b_io_remaining; /* #outstanding I/O requests */ | 187 | atomic_t b_io_remaining; /* #outstanding I/O requests */ |
188 | xfs_buf_iodone_t b_iodone; /* I/O completion function */ | 188 | xfs_buf_iodone_t b_iodone; /* I/O completion function */ |
189 | xfs_buf_relse_t b_relse; /* releasing function */ | 189 | xfs_buf_relse_t b_relse; /* releasing function */ |
190 | xfs_buf_bdstrat_t b_strat; /* pre-write function */ | ||
191 | struct completion b_iowait; /* queue for I/O waiters */ | 190 | struct completion b_iowait; /* queue for I/O waiters */ |
192 | void *b_fspriv; | 191 | void *b_fspriv; |
193 | void *b_fspriv2; | 192 | void *b_fspriv2; |
@@ -245,11 +244,6 @@ extern int xfs_buf_iowait(xfs_buf_t *); | |||
245 | extern void xfs_buf_iomove(xfs_buf_t *, size_t, size_t, void *, | 244 | extern void xfs_buf_iomove(xfs_buf_t *, size_t, size_t, void *, |
246 | xfs_buf_rw_t); | 245 | xfs_buf_rw_t); |
247 | 246 | ||
248 | static inline int xfs_buf_iostrategy(xfs_buf_t *bp) | ||
249 | { | ||
250 | return bp->b_strat ? bp->b_strat(bp) : xfs_buf_iorequest(bp); | ||
251 | } | ||
252 | |||
253 | static inline int xfs_buf_geterror(xfs_buf_t *bp) | 247 | static inline int xfs_buf_geterror(xfs_buf_t *bp) |
254 | { | 248 | { |
255 | return bp ? bp->b_error : ENOMEM; | 249 | return bp ? bp->b_error : ENOMEM; |
@@ -321,8 +315,6 @@ extern void xfs_buf_terminate(void); | |||
321 | #define XFS_BUF_IODONE_FUNC(bp) ((bp)->b_iodone) | 315 | #define XFS_BUF_IODONE_FUNC(bp) ((bp)->b_iodone) |
322 | #define XFS_BUF_SET_IODONE_FUNC(bp, func) ((bp)->b_iodone = (func)) | 316 | #define XFS_BUF_SET_IODONE_FUNC(bp, func) ((bp)->b_iodone = (func)) |
323 | #define XFS_BUF_CLR_IODONE_FUNC(bp) ((bp)->b_iodone = NULL) | 317 | #define XFS_BUF_CLR_IODONE_FUNC(bp) ((bp)->b_iodone = NULL) |
324 | #define XFS_BUF_SET_BDSTRAT_FUNC(bp, func) ((bp)->b_strat = (func)) | ||
325 | #define XFS_BUF_CLR_BDSTRAT_FUNC(bp) ((bp)->b_strat = NULL) | ||
326 | 318 | ||
327 | #define XFS_BUF_FSPRIVATE(bp, type) ((type)(bp)->b_fspriv) | 319 | #define XFS_BUF_FSPRIVATE(bp, type) ((type)(bp)->b_fspriv) |
328 | #define XFS_BUF_SET_FSPRIVATE(bp, val) ((bp)->b_fspriv = (void*)(val)) | 320 | #define XFS_BUF_SET_FSPRIVATE(bp, val) ((bp)->b_fspriv = (void*)(val)) |