xfs: PF_FSTRANS should never be set in ->writepage
authorChristoph Hellwig <hch@lst.de>
Fri, 8 Jul 2011 12:34:05 +0000 (14:34 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 8 Jul 2011 12:34:05 +0000 (14:34 +0200)
Now that we reject direct reclaim in addition to always using GFP_NOFS
allocation there's no chance we'll ever end up in ->writepage with
PF_FSTRANS set.  Add a WARN_ON if we hit this case, and stop checking
if we'd actually need to start a transaction.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/linux-2.6/xfs_aops.c

index 79ce38be15a14c97fdcfd09c4615452d6c9875bd..60e1364a191f343684cbb773229678b81c71618e 100644 (file)
@@ -894,11 +894,6 @@ out_invalidate:
  * For unwritten space on the page we need to start the conversion to
  * regular allocated space.
  * For any other dirty buffer heads on the page we should flush them.
- *
- * If we detect that a transaction would be required to flush the page, we
- * have to check the process flags first, if we are already in a transaction
- * or disk I/O during allocations is off, we need to fail the writepage and
- * redirty the page.
  */
 STATIC int
 xfs_vm_writepage(
@@ -906,7 +901,6 @@ xfs_vm_writepage(
        struct writeback_control *wbc)
 {
        struct inode            *inode = page->mapping->host;
-       int                     delalloc, unwritten;
        struct buffer_head      *bh, *head;
        struct xfs_bmbt_irec    imap;
        xfs_ioend_t             *ioend = NULL, *iohead = NULL;
@@ -938,15 +932,10 @@ xfs_vm_writepage(
                goto redirty;
 
        /*
-        * We need a transaction if there are delalloc or unwritten buffers
-        * on the page.
-        *
-        * If we need a transaction and the process flags say we are already
-        * in a transaction, or no IO is allowed then mark the page dirty
-        * again and leave the page as is.
+        * Given that we do not allow direct reclaim to call us, we should
+        * never be called while in a filesystem transaction.
         */
-       xfs_count_page_state(page, &delalloc, &unwritten);
-       if ((current->flags & PF_FSTRANS) && (delalloc || unwritten))
+       if (WARN_ON(current->flags & PF_FSTRANS))
                goto redirty;
 
        /* Is this page beyond the end of the file? */
This page took 0.042484 seconds and 5 git commands to generate.