diff mbox series

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

Message ID 20201019185911.2909471-1-kent.overstreet@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/2] cifs: convert to add_to_page_cache() | expand

Commit Message

Kent Overstreet Oct. 19, 2020, 6:59 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 | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

Comments

Christoph Hellwig Oct. 20, 2020, 7:58 a.m. UTC | #1
> +	rc = add_to_page_cache(page, mapping,
> +			       page->index, gfp);

This trivially fits onto a single line.
Steve French Oct. 20, 2020, 5:08 p.m. UTC | #2
Other than the unnecessary split line which Christoph pointed out, looks fine.

You can add my Reviewed--by: Steve French <stfrench@microsoft.com>

On Tue, Oct 20, 2020 at 5:10 AM Christoph Hellwig <hch@infradead.org> wrote:
>
> > +     rc = add_to_page_cache(page, mapping,
> > +                            page->index, gfp);
>
> This trivially fits onto a single line.
diff mbox series

Patch

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index be46fab4c9..a17a21181e 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -4296,20 +4296,12 @@  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 +4320,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++;