]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/xfs/xfs_buf.c
Merge tag 'xfs-4.12-merge-7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
[karo-tx-linux.git] / fs / xfs / xfs_buf.c
index ca09061369cb539510ecd6cb7dfdd05a986671e7..62fa39276a24bd91c26e3aa18c9f162f19842b95 100644 (file)
@@ -1079,6 +1079,8 @@ void
 xfs_buf_unlock(
        struct xfs_buf          *bp)
 {
+       ASSERT(xfs_buf_islocked(bp));
+
        XB_CLEAR_OWNER(bp);
        up(&bp->b_sema);
 
@@ -1814,6 +1816,28 @@ error:
        return NULL;
 }
 
+/*
+ * Cancel a delayed write list.
+ *
+ * Remove each buffer from the list, clear the delwri queue flag and drop the
+ * associated buffer reference.
+ */
+void
+xfs_buf_delwri_cancel(
+       struct list_head        *list)
+{
+       struct xfs_buf          *bp;
+
+       while (!list_empty(list)) {
+               bp = list_first_entry(list, struct xfs_buf, b_list);
+
+               xfs_buf_lock(bp);
+               bp->b_flags &= ~_XBF_DELWRI_Q;
+               list_del_init(&bp->b_list);
+               xfs_buf_relse(bp);
+       }
+}
+
 /*
  * Add a buffer to the delayed write list.
  *