aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_buf.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_buf.h')
-rw-r--r--fs/xfs/xfs_buf.h27
1 files changed, 23 insertions, 4 deletions
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index 7f1d1392ce37..c9c2ba90c53c 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -58,6 +58,7 @@ typedef enum {
58#define _XBF_PAGES (1 << 20)/* backed by refcounted pages */ 58#define _XBF_PAGES (1 << 20)/* backed by refcounted pages */
59#define _XBF_KMEM (1 << 21)/* backed by heap memory */ 59#define _XBF_KMEM (1 << 21)/* backed by heap memory */
60#define _XBF_DELWRI_Q (1 << 22)/* buffer on a delwri queue */ 60#define _XBF_DELWRI_Q (1 << 22)/* buffer on a delwri queue */
61#define _XBF_COMPOUND (1 << 23)/* compound buffer */
61 62
62typedef unsigned int xfs_buf_flags_t; 63typedef unsigned int xfs_buf_flags_t;
63 64
@@ -75,7 +76,8 @@ typedef unsigned int xfs_buf_flags_t;
75 { XBF_UNMAPPED, "UNMAPPED" }, /* ditto */\ 76 { XBF_UNMAPPED, "UNMAPPED" }, /* ditto */\
76 { _XBF_PAGES, "PAGES" }, \ 77 { _XBF_PAGES, "PAGES" }, \
77 { _XBF_KMEM, "KMEM" }, \ 78 { _XBF_KMEM, "KMEM" }, \
78 { _XBF_DELWRI_Q, "DELWRI_Q" } 79 { _XBF_DELWRI_Q, "DELWRI_Q" }, \
80 { _XBF_COMPOUND, "COMPOUND" }
79 81
80typedef struct xfs_buftarg { 82typedef struct xfs_buftarg {
81 dev_t bt_dev; 83 dev_t bt_dev;
@@ -98,6 +100,11 @@ typedef void (*xfs_buf_iodone_t)(struct xfs_buf *);
98 100
99#define XB_PAGES 2 101#define XB_PAGES 2
100 102
103struct xfs_buf_map {
104 xfs_daddr_t bm_bn; /* block number for I/O */
105 int bm_len; /* size of I/O */
106};
107
101typedef struct xfs_buf { 108typedef struct xfs_buf {
102 /* 109 /*
103 * first cacheline holds all the fields needed for an uncontended cache 110 * first cacheline holds all the fields needed for an uncontended cache
@@ -107,7 +114,7 @@ typedef struct xfs_buf {
107 * fast-path on locking. 114 * fast-path on locking.
108 */ 115 */
109 struct rb_node b_rbnode; /* rbtree node */ 116 struct rb_node b_rbnode; /* rbtree node */
110 xfs_daddr_t b_bn; /* block number for I/O */ 117 xfs_daddr_t b_bn; /* block number of buffer */
111 int b_length; /* size of buffer in BBs */ 118 int b_length; /* size of buffer in BBs */
112 atomic_t b_hold; /* reference count */ 119 atomic_t b_hold; /* reference count */
113 atomic_t b_lru_ref; /* lru reclaim ref count */ 120 atomic_t b_lru_ref; /* lru reclaim ref count */
@@ -127,12 +134,14 @@ typedef struct xfs_buf {
127 struct xfs_trans *b_transp; 134 struct xfs_trans *b_transp;
128 struct page **b_pages; /* array of page pointers */ 135 struct page **b_pages; /* array of page pointers */
129 struct page *b_page_array[XB_PAGES]; /* inline pages */ 136 struct page *b_page_array[XB_PAGES]; /* inline pages */
137 struct xfs_buf_map b_map; /* compound buffer map */
130 int b_io_length; /* IO size in BBs */ 138 int b_io_length; /* IO size in BBs */
131 atomic_t b_pin_count; /* pin count */ 139 atomic_t b_pin_count; /* pin count */
132 atomic_t b_io_remaining; /* #outstanding I/O requests */ 140 atomic_t b_io_remaining; /* #outstanding I/O requests */
133 unsigned int b_page_count; /* size of page array */ 141 unsigned int b_page_count; /* size of page array */
134 unsigned int b_offset; /* page offset in first page */ 142 unsigned int b_offset; /* page offset in first page */
135 unsigned short b_error; /* error code on I/O */ 143 unsigned short b_error; /* error code on I/O */
144
136#ifdef XFS_BUF_LOCK_TRACKING 145#ifdef XFS_BUF_LOCK_TRACKING
137 int b_last_holder; 146 int b_last_holder;
138#endif 147#endif
@@ -233,8 +242,18 @@ void xfs_buf_stale(struct xfs_buf *bp);
233#define XFS_BUF_UNWRITE(bp) ((bp)->b_flags &= ~XBF_WRITE) 242#define XFS_BUF_UNWRITE(bp) ((bp)->b_flags &= ~XBF_WRITE)
234#define XFS_BUF_ISWRITE(bp) ((bp)->b_flags & XBF_WRITE) 243#define XFS_BUF_ISWRITE(bp) ((bp)->b_flags & XBF_WRITE)
235 244
236#define XFS_BUF_ADDR(bp) ((bp)->b_bn) 245/*
237#define XFS_BUF_SET_ADDR(bp, bno) ((bp)->b_bn = (xfs_daddr_t)(bno)) 246 * These macros use the IO block map rather than b_bn. b_bn is now really
247 * just for the buffer cache index for cached buffers. As IO does not use b_bn
248 * anymore, uncached buffers do not use b_bn at all and hence must modify the IO
249 * map directly. Uncached buffers are not allowed to be discontiguous, so this
250 * is safe to do.
251 *
252 * In future, uncached buffers will pass the block number directly to the io
253 * request function and hence these macros will go away at that point.
254 */
255#define XFS_BUF_ADDR(bp) ((bp)->b_map.bm_bn)
256#define XFS_BUF_SET_ADDR(bp, bno) ((bp)->b_map.bm_bn = (xfs_daddr_t)(bno))
238 257
239static inline void xfs_buf_set_ref(struct xfs_buf *bp, int lru_ref) 258static inline void xfs_buf_set_ref(struct xfs_buf *bp, int lru_ref)
240{ 259{