diff mbox series

[v2,1/2] cifs: convert to add_to_page_cache()

Message ID 20201021195745.3420101-2-kent.overstreet@gmail.com (mailing list archive)
State New, archived
Headers show
Series kill add_to_page_cache_locked() | expand

Commit Message

Kent Overstreet Oct. 21, 2020, 7:57 p.m. UTC
This is just open coding add_to_page_cache(), and the next patch will
delete add_to_page_cache_locked().

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
---
 fs/cifs/file.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

Comments

Steve French Oct. 22, 2020, 8:36 a.m. UTC | #1
you can add my reviewed-by if you would like

On Thu, Oct 22, 2020 at 1:48 AM Kent Overstreet
<kent.overstreet@gmail.com> wrote:
>
> This is just open coding add_to_page_cache(), and the next patch will
> delete add_to_page_cache_locked().
>
> Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
> ---
>  fs/cifs/file.c | 20 ++++----------------
>  1 file changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index be46fab4c9..b3ee790532 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -4296,20 +4296,11 @@ readpages_get_pages(struct address_space *mapping, struct list_head *page_list,
>
>         page = lru_to_page(page_list);
>
> -       /*
> -        * Lock the page and put it in the cache. Since no one else
> -        * should have access to this page, we're safe to simply set
> -        * PG_locked without checking it first.
> -        */
> -       __SetPageLocked(page);
> -       rc = add_to_page_cache_locked(page, mapping,
> -                                     page->index, gfp);
> +       rc = add_to_page_cache(page, mapping, page->index, gfp);
>
>         /* give up if we can't stick it in the cache */
> -       if (rc) {
> -               __ClearPageLocked(page);
> +       if (rc)
>                 return rc;
> -       }
>
>         /* move first page to the tmplist */
>         *offset = (loff_t)page->index << PAGE_SHIFT;
> @@ -4328,12 +4319,9 @@ readpages_get_pages(struct address_space *mapping, struct list_head *page_list,
>                 if (*bytes + PAGE_SIZE > rsize)
>                         break;
>
> -               __SetPageLocked(page);
> -               rc = add_to_page_cache_locked(page, mapping, page->index, gfp);
> -               if (rc) {
> -                       __ClearPageLocked(page);
> +               rc = add_to_page_cache(page, mapping, page->index, gfp);
> +               if (rc)
>                         break;
> -               }
>                 list_move_tail(&page->lru, tmplist);
>                 (*bytes) += PAGE_SIZE;
>                 expected_index++;
> --
> 2.28.0
>
Matthew Wilcox Nov. 11, 2020, 12:52 a.m. UTC | #2
On Wed, Oct 21, 2020 at 03:57:44PM -0400, Kent Overstreet wrote:
> This is just open coding add_to_page_cache(), and the next patch will
> delete add_to_page_cache_locked().
> 
> Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
diff mbox series

Patch

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index be46fab4c9..b3ee790532 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -4296,20 +4296,11 @@  readpages_get_pages(struct address_space *mapping, struct list_head *page_list,
 
 	page = lru_to_page(page_list);
 
-	/*
-	 * Lock the page and put it in the cache. Since no one else
-	 * should have access to this page, we're safe to simply set
-	 * PG_locked without checking it first.
-	 */
-	__SetPageLocked(page);
-	rc = add_to_page_cache_locked(page, mapping,
-				      page->index, gfp);
+	rc = add_to_page_cache(page, mapping, page->index, gfp);
 
 	/* give up if we can't stick it in the cache */
-	if (rc) {
-		__ClearPageLocked(page);
+	if (rc)
 		return rc;
-	}
 
 	/* move first page to the tmplist */
 	*offset = (loff_t)page->index << PAGE_SHIFT;
@@ -4328,12 +4319,9 @@  readpages_get_pages(struct address_space *mapping, struct list_head *page_list,
 		if (*bytes + PAGE_SIZE > rsize)
 			break;
 
-		__SetPageLocked(page);
-		rc = add_to_page_cache_locked(page, mapping, page->index, gfp);
-		if (rc) {
-			__ClearPageLocked(page);
+		rc = add_to_page_cache(page, mapping, page->index, gfp);
+		if (rc)
 			break;
-		}
 		list_move_tail(&page->lru, tmplist);
 		(*bytes) += PAGE_SIZE;
 		expected_index++;