aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_alloc.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_alloc.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_alloc.c')
-rw-r--r--fs/xfs/xfs_alloc.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index 545a6c4c2366..393055fe3aef 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -465,7 +465,7 @@ xfs_agfl_verify(
465#endif 465#endif
466} 466}
467 467
468void 468static void
469xfs_agfl_write_verify( 469xfs_agfl_write_verify(
470 struct xfs_buf *bp) 470 struct xfs_buf *bp)
471{ 471{
@@ -477,11 +477,13 @@ xfs_agfl_read_verify(
477 struct xfs_buf *bp) 477 struct xfs_buf *bp)
478{ 478{
479 xfs_agfl_verify(bp); 479 xfs_agfl_verify(bp);
480 bp->b_pre_io = xfs_agfl_write_verify;
481 bp->b_iodone = NULL;
482 xfs_buf_ioend(bp, 0);
483} 480}
484 481
482const struct xfs_buf_ops xfs_agfl_buf_ops = {
483 .verify_read = xfs_agfl_read_verify,
484 .verify_write = xfs_agfl_write_verify,
485};
486
485/* 487/*
486 * Read in the allocation group free block array. 488 * Read in the allocation group free block array.
487 */ 489 */
@@ -499,7 +501,7 @@ xfs_alloc_read_agfl(
499 error = xfs_trans_read_buf( 501 error = xfs_trans_read_buf(
500 mp, tp, mp->m_ddev_targp, 502 mp, tp, mp->m_ddev_targp,
501 XFS_AG_DADDR(mp, agno, XFS_AGFL_DADDR(mp)), 503 XFS_AG_DADDR(mp, agno, XFS_AGFL_DADDR(mp)),
502 XFS_FSS_TO_BB(mp, 1), 0, &bp, xfs_agfl_read_verify); 504 XFS_FSS_TO_BB(mp, 1), 0, &bp, &xfs_agfl_buf_ops);
503 if (error) 505 if (error)
504 return error; 506 return error;
505 ASSERT(!xfs_buf_geterror(bp)); 507 ASSERT(!xfs_buf_geterror(bp));
@@ -2181,23 +2183,25 @@ xfs_agf_verify(
2181 } 2183 }
2182} 2184}
2183 2185
2184void 2186static void
2185xfs_agf_write_verify( 2187xfs_agf_read_verify(
2186 struct xfs_buf *bp) 2188 struct xfs_buf *bp)
2187{ 2189{
2188 xfs_agf_verify(bp); 2190 xfs_agf_verify(bp);
2189} 2191}
2190 2192
2191static void 2193static void
2192xfs_agf_read_verify( 2194xfs_agf_write_verify(
2193 struct xfs_buf *bp) 2195 struct xfs_buf *bp)
2194{ 2196{
2195 xfs_agf_verify(bp); 2197 xfs_agf_verify(bp);
2196 bp->b_pre_io = xfs_agf_write_verify;
2197 bp->b_iodone = NULL;
2198 xfs_buf_ioend(bp, 0);
2199} 2198}
2200 2199
2200const struct xfs_buf_ops xfs_agf_buf_ops = {
2201 .verify_read = xfs_agf_read_verify,
2202 .verify_write = xfs_agf_write_verify,
2203};
2204
2201/* 2205/*
2202 * Read in the allocation group header (free/alloc section). 2206 * Read in the allocation group header (free/alloc section).
2203 */ 2207 */
@@ -2215,7 +2219,7 @@ xfs_read_agf(
2215 error = xfs_trans_read_buf( 2219 error = xfs_trans_read_buf(
2216 mp, tp, mp->m_ddev_targp, 2220 mp, tp, mp->m_ddev_targp,
2217 XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)), 2221 XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)),
2218 XFS_FSS_TO_BB(mp, 1), flags, bpp, xfs_agf_read_verify); 2222 XFS_FSS_TO_BB(mp, 1), flags, bpp, &xfs_agf_buf_ops);
2219 if (error) 2223 if (error)
2220 return error; 2224 return error;
2221 if (!*bpp) 2225 if (!*bpp)