Skip to content

Commit c12b6a7

Browse files
author
Trond Myklebust
committed
NFS: Fix the marking of the folio as up to date
Since all callers of nfs_page_group_covers_page() have already ensured that there is only one group member, all that is required is to check that the entire folio contains dirty data. Signed-off-by: Trond Myklebust <[email protected]>
1 parent b7b8574 commit c12b6a7

File tree

1 file changed

+5
-47
lines changed

1 file changed

+5
-47
lines changed

fs/nfs/write.c

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -237,59 +237,17 @@ static void nfs_mapping_set_error(struct folio *folio, int error)
237237
}
238238

239239
/*
240-
* nfs_page_group_search_locked
241-
* @head - head request of page group
242-
* @page_offset - offset into page
240+
* nfs_page_covers_folio
241+
* @req: struct nfs_page
243242
*
244-
* Search page group with head @head to find a request that contains the
245-
* page offset @page_offset.
246-
*
247-
* Returns a pointer to the first matching nfs request, or NULL if no
248-
* match is found.
249-
*
250-
* Must be called with the page group lock held
251-
*/
252-
static struct nfs_page *
253-
nfs_page_group_search_locked(struct nfs_page *head, unsigned int page_offset)
254-
{
255-
struct nfs_page *req;
256-
257-
req = head;
258-
do {
259-
if (page_offset >= req->wb_pgbase &&
260-
page_offset < (req->wb_pgbase + req->wb_bytes))
261-
return req;
262-
263-
req = req->wb_this_page;
264-
} while (req != head);
265-
266-
return NULL;
267-
}
268-
269-
/*
270-
* nfs_page_group_covers_page
271-
* @head - head request of page group
272-
*
273-
* Return true if the page group with head @head covers the whole page,
274-
* returns false otherwise
243+
* Return true if the request covers the whole folio.
244+
* Note that the caller should ensure all subrequests have been joined
275245
*/
276246
static bool nfs_page_group_covers_page(struct nfs_page *req)
277247
{
278248
unsigned int len = nfs_folio_length(nfs_page_to_folio(req));
279-
struct nfs_page *tmp;
280-
unsigned int pos = 0;
281-
282-
nfs_page_group_lock(req);
283249

284-
for (;;) {
285-
tmp = nfs_page_group_search_locked(req->wb_head, pos);
286-
if (!tmp)
287-
break;
288-
pos = tmp->wb_pgbase + tmp->wb_bytes;
289-
}
290-
291-
nfs_page_group_unlock(req);
292-
return pos >= len;
250+
return req->wb_pgbase == 0 && req->wb_bytes == len;
293251
}
294252

295253
/* We can set the PG_uptodate flag if we see that a write request

0 commit comments

Comments
 (0)