Skip to content

Commit 0df5564

Browse files
johnhubbardhubcapsc
authored andcommitted
orangefs: convert get_user_pages() --> pin_user_pages()
This code was using get_user_pages*(), in a "Case 1" scenario (Direct IO), using the categorization from [1]. That means that it's time to convert the get_user_pages*() + put_page() calls to pin_user_pages*() + unpin_user_pages() calls. There is some helpful background in [2]: basically, this is a small part of fixing a long-standing disconnect between pinning pages, and file systems' use of those pages. [1] Documentation/core-api/pin_user_pages.rst [2] "Explicit pinning of user-space pages": https://lwn.net/Articles/807108/ Cc: Mike Marshall <[email protected]> Cc: Martin Brandenburg <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: John Hubbard <[email protected]> Signed-off-by: Mike Marshall <[email protected]>
1 parent 22ce856 commit 0df5564

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

fs/orangefs/orangefs-bufmap.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,7 @@ static DEFINE_SPINLOCK(orangefs_bufmap_lock);
168168
static void
169169
orangefs_bufmap_unmap(struct orangefs_bufmap *bufmap)
170170
{
171-
int i;
172-
173-
for (i = 0; i < bufmap->page_count; i++)
174-
put_page(bufmap->page_array[i]);
171+
unpin_user_pages(bufmap->page_array, bufmap->page_count);
175172
}
176173

177174
static void
@@ -268,7 +265,7 @@ orangefs_bufmap_map(struct orangefs_bufmap *bufmap,
268265
int offset = 0, ret, i;
269266

270267
/* map the pages */
271-
ret = get_user_pages_fast((unsigned long)user_desc->ptr,
268+
ret = pin_user_pages_fast((unsigned long)user_desc->ptr,
272269
bufmap->page_count, FOLL_WRITE, bufmap->page_array);
273270

274271
if (ret < 0)
@@ -280,7 +277,7 @@ orangefs_bufmap_map(struct orangefs_bufmap *bufmap,
280277

281278
for (i = 0; i < ret; i++) {
282279
SetPageError(bufmap->page_array[i]);
283-
put_page(bufmap->page_array[i]);
280+
unpin_user_page(bufmap->page_array[i]);
284281
}
285282
return -ENOMEM;
286283
}

0 commit comments

Comments
 (0)