xfs: convert buffer verifiers to an ops structure.
[deliverable/linux.git] / fs / xfs / xfs_inode.c
index 514eac913f1cc0c3b9759e488f80759a06a7a416..66282dcb821bfe2e969f80b35e2eaa42a98fc6ed 100644 (file)
@@ -418,10 +418,29 @@ xfs_inode_buf_verify(
                }
        }
        xfs_inobp_check(mp, bp);
-       bp->b_iodone = NULL;
-       xfs_buf_ioend(bp, 0);
 }
 
+
+static void
+xfs_inode_buf_read_verify(
+       struct xfs_buf  *bp)
+{
+       xfs_inode_buf_verify(bp);
+}
+
+static void
+xfs_inode_buf_write_verify(
+       struct xfs_buf  *bp)
+{
+       xfs_inode_buf_verify(bp);
+}
+
+const struct xfs_buf_ops xfs_inode_buf_ops = {
+       .verify_read = xfs_inode_buf_read_verify,
+       .verify_write = xfs_inode_buf_write_verify,
+};
+
+
 /*
  * This routine is called to map an inode to the buffer containing the on-disk
  * version of the inode.  It returns a pointer to the buffer containing the
@@ -447,7 +466,7 @@ xfs_imap_to_bp(
        buf_flags |= XBF_UNMAPPED;
        error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, imap->im_blkno,
                                   (int)imap->im_len, buf_flags, &bp,
-                                  xfs_inode_buf_verify);
+                                  &xfs_inode_buf_ops);
        if (error) {
                if (error == EAGAIN) {
                        ASSERT(buf_flags & XBF_TRYLOCK);
@@ -1767,6 +1786,18 @@ xfs_ifree_cluster(
 
                if (!bp)
                        return ENOMEM;
+
+               /*
+                * This buffer may not have been correctly initialised as we
+                * didn't read it from disk. That's not important because we are
+                * only using to mark the buffer as stale in the log, and to
+                * attach stale cached inodes on it. That means it will never be
+                * dispatched for IO. If it is, we want to know about it, and we
+                * want it to fail. We can acheive this by adding a write
+                * verifier to the buffer.
+                */
+                bp->b_ops = &xfs_inode_buf_ops;
+
                /*
                 * Walk the inodes already attached to the buffer and mark them
                 * stale. These will all have the flush locks held, so an
This page took 0.027832 seconds and 5 git commands to generate.