author: Gao Xiang <hsiangkao@redhat.com> 2021-04-07 12:39:26 +0800
committer: Gao Xiang <hsiangkao@redhat.com> 2021-04-10 03:20:19 +0800
commit: 598162d050801e556750defff4ddab499e5d76ed
parent: b86269f43892316ef5a177d7180d09d101a46f22
Commit Summary:
Diffstat:
1 file changed, 13 insertions, 0 deletions
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index 5c2388daee6e..f92e3e32b9f4 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -402,6 +402,21 @@ int erofs_namei(struct inode *dir, struct qstr *name,
/* dir.c */
extern const struct file_operations erofs_dir_fops;
+static inline void *erofs_vm_map_ram(struct page **pages, unsigned int count)
+{
+ int retried = 0;
+
+ while (1) {
+ void *p = vm_map_ram(pages, count, -1);
+
+ /* retry two more times (totally 3 times) */
+ if (p || ++retried >= 3)
+ return p;
+ vm_unmap_aliases();
+ }
+ return NULL;
+}
+
/* pcpubuf.c */
void *erofs_get_pcpubuf(unsigned int requiredpages);
void erofs_put_pcpubuf(void *ptr);