aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_block.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2012-11-14 01:54:40 -0500
committerBen Myers <bpm@sgi.com>2012-11-15 22:35:12 -0500
commit1813dd64057490e7a0678a885c4fe6d02f78bdc1 (patch)
treecaf95e2be7881b771da65561b2f1664d73588401 /fs/xfs/xfs_dir2_block.c
parentb0f539de9fcc543a3ffa40bc22bf51aca6ea6183 (diff)
xfs: convert buffer verifiers to an ops structure.
To separate the verifiers from iodone functions and associate read and write verifiers at the same time, introduce a buffer verifier operations structure to the xfs_buf. This avoids the need for assigning the write verifier, clearing the iodone function and re-running ioend processing in the read verifier, and gets rid of the nasty "b_pre_io" name for the write verifier function pointer. If we ever need to, it will also be easier to add further content specific callbacks to a buffer with an ops structure in place. We also avoid needing to export verifier functions, instead we can simply export the ops structures for those that are needed outside the function they are defined in. This patch also fixes a directory block readahead verifier issue it exposed. This patch also adds ops callbacks to the inode/alloc btree blocks initialised by growfs. These will need more work before they will work with CRCs. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Phil White <pwhite@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_dir2_block.c')
-rw-r--r--fs/xfs/xfs_dir2_block.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index e2fdc6f03d8a..7536faaa61e7 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -74,22 +74,24 @@ xfs_dir2_block_verify(
74} 74}
75 75
76static void 76static void
77xfs_dir2_block_write_verify( 77xfs_dir2_block_read_verify(
78 struct xfs_buf *bp) 78 struct xfs_buf *bp)
79{ 79{
80 xfs_dir2_block_verify(bp); 80 xfs_dir2_block_verify(bp);
81} 81}
82 82
83void 83static void
84xfs_dir2_block_read_verify( 84xfs_dir2_block_write_verify(
85 struct xfs_buf *bp) 85 struct xfs_buf *bp)
86{ 86{
87 xfs_dir2_block_verify(bp); 87 xfs_dir2_block_verify(bp);
88 bp->b_pre_io = xfs_dir2_block_write_verify;
89 bp->b_iodone = NULL;
90 xfs_buf_ioend(bp, 0);
91} 88}
92 89
90const struct xfs_buf_ops xfs_dir2_block_buf_ops = {
91 .verify_read = xfs_dir2_block_read_verify,
92 .verify_write = xfs_dir2_block_write_verify,
93};
94
93static int 95static int
94xfs_dir2_block_read( 96xfs_dir2_block_read(
95 struct xfs_trans *tp, 97 struct xfs_trans *tp,
@@ -99,7 +101,7 @@ xfs_dir2_block_read(
99 struct xfs_mount *mp = dp->i_mount; 101 struct xfs_mount *mp = dp->i_mount;
100 102
101 return xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, bpp, 103 return xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, bpp,
102 XFS_DATA_FORK, xfs_dir2_block_read_verify); 104 XFS_DATA_FORK, &xfs_dir2_block_buf_ops);
103} 105}
104 106
105static void 107static void
@@ -1010,7 +1012,7 @@ xfs_dir2_leaf_to_block(
1010 /* 1012 /*
1011 * Start converting it to block form. 1013 * Start converting it to block form.
1012 */ 1014 */
1013 dbp->b_pre_io = xfs_dir2_block_write_verify; 1015 dbp->b_ops = &xfs_dir2_block_buf_ops;
1014 hdr->magic = cpu_to_be32(XFS_DIR2_BLOCK_MAGIC); 1016 hdr->magic = cpu_to_be32(XFS_DIR2_BLOCK_MAGIC);
1015 needlog = 1; 1017 needlog = 1;
1016 needscan = 0; 1018 needscan = 0;
@@ -1140,7 +1142,7 @@ xfs_dir2_sf_to_block(
1140 kmem_free(sfp); 1142 kmem_free(sfp);
1141 return error; 1143 return error;
1142 } 1144 }
1143 bp->b_pre_io = xfs_dir2_block_write_verify; 1145 bp->b_ops = &xfs_dir2_block_buf_ops;
1144 hdr = bp->b_addr; 1146 hdr = bp->b_addr;
1145 hdr->magic = cpu_to_be32(XFS_DIR2_BLOCK_MAGIC); 1147 hdr->magic = cpu_to_be32(XFS_DIR2_BLOCK_MAGIC);
1146 /* 1148 /*