[PATCH 06/10] fs: iomap use memalloc_nofs_* scope API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx>

While we are at it, remove the flags parameter from iomap_write_begin()
since we passed AOP_FLAG_NOFS to it.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx>
---
 fs/iomap.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/fs/iomap.c b/fs/iomap.c
index afd163586aa0..afaf6ffff34f 100644
--- a/fs/iomap.c
+++ b/fs/iomap.c
@@ -27,6 +27,7 @@
 #include <linux/task_io_accounting_ops.h>
 #include <linux/dax.h>
 #include <linux/sched/signal.h>
+#include <linux/sched/mm.h>
 
 #include "internal.h"
 
@@ -109,19 +110,22 @@ iomap_write_failed(struct inode *inode, loff_t pos, unsigned len)
 }
 
 static int
-iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, unsigned flags,
+iomap_write_begin(struct inode *inode, loff_t pos, unsigned len,
 		struct page **pagep, struct iomap *iomap)
 {
 	pgoff_t index = pos >> PAGE_SHIFT;
 	struct page *page;
 	int status = 0;
+	unsigned nofs_flags;
 
 	BUG_ON(pos + len > iomap->offset + iomap->length);
 
 	if (fatal_signal_pending(current))
 		return -EINTR;
 
-	page = grab_cache_page_write_begin(inode->i_mapping, index, flags);
+	nofs_flags = memalloc_nofs_save();
+	page = grab_cache_page_write_begin(inode->i_mapping, index, 0);
+	memalloc_nofs_restore(nofs_flags);
 	if (!page)
 		return -ENOMEM;
 
@@ -158,7 +162,6 @@ iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
 	struct iov_iter *i = data;
 	long status = 0;
 	ssize_t written = 0;
-	unsigned int flags = AOP_FLAG_NOFS;
 
 	do {
 		struct page *page;
@@ -188,7 +191,7 @@ iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
 			break;
 		}
 
-		status = iomap_write_begin(inode, pos, bytes, flags, &page,
+		status = iomap_write_begin(inode, pos, bytes, &page,
 				iomap);
 		if (unlikely(status))
 			break;
@@ -287,7 +290,7 @@ iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
 			return PTR_ERR(rpage);
 
 		status = iomap_write_begin(inode, pos, bytes,
-					   AOP_FLAG_NOFS, &page, iomap);
+					   &page, iomap);
 		put_page(rpage);
 		if (unlikely(status))
 			return status;
@@ -338,7 +341,7 @@ static int iomap_zero(struct inode *inode, loff_t pos, unsigned offset,
 	struct page *page;
 	int status;
 
-	status = iomap_write_begin(inode, pos, bytes, AOP_FLAG_NOFS, &page,
+	status = iomap_write_begin(inode, pos, bytes, &page,
 				   iomap);
 	if (status)
 		return status;
-- 
2.16.1




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux