aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index a70c5790f8f5..e8d9f9c8d00d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8534,15 +8534,28 @@ int btrfs_readpage(struct file *file, struct page *page)
8534static int btrfs_writepage(struct page *page, struct writeback_control *wbc) 8534static int btrfs_writepage(struct page *page, struct writeback_control *wbc)
8535{ 8535{
8536 struct extent_io_tree *tree; 8536 struct extent_io_tree *tree;
8537 8537 struct inode *inode = page->mapping->host;
8538 int ret;
8538 8539
8539 if (current->flags & PF_MEMALLOC) { 8540 if (current->flags & PF_MEMALLOC) {
8540 redirty_page_for_writepage(wbc, page); 8541 redirty_page_for_writepage(wbc, page);
8541 unlock_page(page); 8542 unlock_page(page);
8542 return 0; 8543 return 0;
8543 } 8544 }
8545
8546 /*
8547 * If we are under memory pressure we will call this directly from the
8548 * VM, we need to make sure we have the inode referenced for the ordered
8549 * extent. If not just return like we didn't do anything.
8550 */
8551 if (!igrab(inode)) {
8552 redirty_page_for_writepage(wbc, page);
8553 return AOP_WRITEPAGE_ACTIVATE;
8554 }
8544 tree = &BTRFS_I(page->mapping->host)->io_tree; 8555 tree = &BTRFS_I(page->mapping->host)->io_tree;
8545 return extent_write_full_page(tree, page, btrfs_get_extent, wbc); 8556 ret = extent_write_full_page(tree, page, btrfs_get_extent, wbc);
8557 btrfs_add_delayed_iput(inode);
8558 return ret;
8546} 8559}
8547 8560
8548static int btrfs_writepages(struct address_space *mapping, 8561static int btrfs_writepages(struct address_space *mapping,