]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - fs/xfs/xfs_trans_buf.c
xfs: Code cleanup and removal of some typedef usage
[mirror_ubuntu-artful-kernel.git] / fs / xfs / xfs_trans_buf.c
index 73a5fa457e16ddd72c4a45631cda8a5ae05fdbf6..aa5a04b844d6d530b12edd39b3f99240aff625bc 100644 (file)
@@ -397,7 +397,6 @@ shutdown_abort:
        return XFS_ERROR(EIO);
 }
 
-
 /*
  * Release the buffer bp which was previously acquired with one of the
  * xfs_trans_... buffer allocation routines if the buffer has not
@@ -603,8 +602,14 @@ xfs_trans_log_buf(xfs_trans_t      *tp,
 
        tp->t_flags |= XFS_TRANS_DIRTY;
        bip->bli_item.li_desc->lid_flags |= XFS_LID_DIRTY;
-       bip->bli_flags |= XFS_BLI_LOGGED;
-       xfs_buf_item_log(bip, first, last);
+
+       /*
+        * If we have an ordered buffer we are not logging any dirty range but
+        * it still needs to be marked dirty and that it has been logged.
+        */
+       bip->bli_flags |= XFS_BLI_DIRTY | XFS_BLI_LOGGED;
+       if (!(bip->bli_flags & XFS_BLI_ORDERED))
+               xfs_buf_item_log(bip, first, last);
 }
 
 
@@ -756,6 +761,29 @@ xfs_trans_inode_alloc_buf(
        xfs_trans_buf_set_type(tp, bp, XFS_BLFT_DINO_BUF);
 }
 
+/*
+ * Mark the buffer as ordered for this transaction. This means
+ * that the contents of the buffer are not recorded in the transaction
+ * but it is tracked in the AIL as though it was. This allows us
+ * to record logical changes in transactions rather than the physical
+ * changes we make to the buffer without changing writeback ordering
+ * constraints of metadata buffers.
+ */
+void
+xfs_trans_ordered_buf(
+       struct xfs_trans        *tp,
+       struct xfs_buf          *bp)
+{
+       struct xfs_buf_log_item *bip = bp->b_fspriv;
+
+       ASSERT(bp->b_transp == tp);
+       ASSERT(bip != NULL);
+       ASSERT(atomic_read(&bip->bli_refcount) > 0);
+
+       bip->bli_flags |= XFS_BLI_ORDERED;
+       trace_xfs_buf_item_ordered(bip);
+}
+
 /*
  * Set the type of the buffer for log recovery so that it can correctly identify
  * and hence attach the correct buffer ops to the buffer after replay.