Commit 680a647b authored by Christoph Hellwig's avatar Christoph Hellwig

xfs: PF_FSTRANS should never be set in ->writepage

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent 1316d4da
...@@ -894,11 +894,6 @@ xfs_aops_discard_page( ...@@ -894,11 +894,6 @@ xfs_aops_discard_page(
* For unwritten space on the page we need to start the conversion to * For unwritten space on the page we need to start the conversion to
* regular allocated space. * regular allocated space.
* For any other dirty buffer heads on the page we should flush them. * 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 STATIC int
xfs_vm_writepage( xfs_vm_writepage(
...@@ -906,7 +901,6 @@ xfs_vm_writepage( ...@@ -906,7 +901,6 @@ xfs_vm_writepage(
struct writeback_control *wbc) struct writeback_control *wbc)
{ {
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
int delalloc, unwritten;
struct buffer_head *bh, *head; struct buffer_head *bh, *head;
struct xfs_bmbt_irec imap; struct xfs_bmbt_irec imap;
xfs_ioend_t *ioend = NULL, *iohead = NULL; xfs_ioend_t *ioend = NULL, *iohead = NULL;
...@@ -938,15 +932,10 @@ xfs_vm_writepage( ...@@ -938,15 +932,10 @@ xfs_vm_writepage(
goto redirty; goto redirty;
/* /*
* We need a transaction if there are delalloc or unwritten buffers * Given that we do not allow direct reclaim to call us, we should
* on the page. * never be called while in a filesystem transaction.
*
* 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.
*/ */
xfs_count_page_state(page, &delalloc, &unwritten); if (WARN_ON(current->flags & PF_FSTRANS))
if ((current->flags & PF_FSTRANS) && (delalloc || unwritten))
goto redirty; goto redirty;
/* Is this page beyond the end of the file? */ /* Is this page beyond the end of the file? */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment