Skip to content

Commit 7e8e78a

Browse files
Christoph Hellwigamschuma-ntap
authored andcommitted
nfs: remove dead code for the old swap over NFS implementation
Remove the code testing folio_test_swapcache either explicitly or implicitly in pagemap.h headers, as is now handled using the direct I/O path and not the buffered I/O path that these helpers are located in. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 4840c00 commit 7e8e78a

File tree

10 files changed

+36
-186
lines changed

10 files changed

+36
-186
lines changed

fs/nfs/file.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,
427427
static void nfs_invalidate_folio(struct folio *folio, size_t offset,
428428
size_t length)
429429
{
430-
struct inode *inode = folio_file_mapping(folio)->host;
430+
struct inode *inode = folio->mapping->host;
431431
dfprintk(PAGECACHE, "NFS: invalidate_folio(%lu, %zu, %zu)\n",
432432
folio->index, offset, length);
433433

@@ -454,7 +454,7 @@ static bool nfs_release_folio(struct folio *folio, gfp_t gfp)
454454
if ((current_gfp_context(gfp) & GFP_KERNEL) != GFP_KERNEL ||
455455
current_is_kswapd())
456456
return false;
457-
if (nfs_wb_folio(folio_file_mapping(folio)->host, folio) < 0)
457+
if (nfs_wb_folio(folio->mapping->host, folio) < 0)
458458
return false;
459459
}
460460
return nfs_fscache_release_folio(folio, gfp);
@@ -606,7 +606,7 @@ static vm_fault_t nfs_vm_page_mkwrite(struct vm_fault *vmf)
606606
TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
607607

608608
folio_lock(folio);
609-
mapping = folio_file_mapping(folio);
609+
mapping = folio->mapping;
610610
if (mapping != inode->i_mapping)
611611
goto out_unlock;
612612

fs/nfs/filelayout/filelayout.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,6 @@ static const struct pnfs_commit_ops filelayout_commit_ops = {
11101110
.clear_request_commit = pnfs_generic_clear_request_commit,
11111111
.scan_commit_lists = pnfs_generic_scan_commit_lists,
11121112
.recover_commit_reqs = pnfs_generic_recover_commit_reqs,
1113-
.search_commit_reqs = pnfs_generic_search_commit_reqs,
11141113
.commit_pagelist = filelayout_commit_pagelist,
11151114
};
11161115

fs/nfs/fscache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ void nfs_netfs_initiate_read(struct nfs_pgio_header *hdr)
341341

342342
int nfs_netfs_folio_unlock(struct folio *folio)
343343
{
344-
struct inode *inode = folio_file_mapping(folio)->host;
344+
struct inode *inode = folio->mapping->host;
345345

346346
/*
347347
* If fscache is enabled, netfs will unlock pages.

fs/nfs/internal.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ static inline void nfs_folio_mark_unstable(struct folio *folio,
785785
struct nfs_commit_info *cinfo)
786786
{
787787
if (folio && !cinfo->dreq) {
788-
struct inode *inode = folio_file_mapping(folio)->host;
788+
struct inode *inode = folio->mapping->host;
789789
long nr = folio_nr_pages(folio);
790790

791791
/* This page is really still in write-back - just that the
@@ -803,7 +803,7 @@ static inline void nfs_folio_mark_unstable(struct folio *folio,
803803
static inline
804804
unsigned int nfs_page_length(struct page *page)
805805
{
806-
loff_t i_size = i_size_read(page_file_mapping(page)->host);
806+
loff_t i_size = i_size_read(page->mapping->host);
807807

808808
if (i_size > 0) {
809809
pgoff_t index = page_index(page);
@@ -821,10 +821,10 @@ unsigned int nfs_page_length(struct page *page)
821821
*/
822822
static inline size_t nfs_folio_length(struct folio *folio)
823823
{
824-
loff_t i_size = i_size_read(folio_file_mapping(folio)->host);
824+
loff_t i_size = i_size_read(folio->mapping->host);
825825

826826
if (i_size > 0) {
827-
pgoff_t index = folio_index(folio) >> folio_order(folio);
827+
pgoff_t index = folio->index >> folio_order(folio);
828828
pgoff_t end_index = (i_size - 1) >> folio_shift(folio);
829829
if (index < end_index)
830830
return folio_size(folio);

fs/nfs/pagelist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ struct nfs_page *nfs_page_create_from_folio(struct nfs_open_context *ctx,
569569

570570
if (IS_ERR(l_ctx))
571571
return ERR_CAST(l_ctx);
572-
ret = nfs_page_create(l_ctx, offset, folio_index(folio), offset, count);
572+
ret = nfs_page_create(l_ctx, offset, folio->index, offset, count);
573573
if (!IS_ERR(ret)) {
574574
nfs_page_assign_folio(ret, folio);
575575
nfs_page_group_init(ret, NULL);

fs/nfs/pnfs.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,6 @@ struct pnfs_commit_ops {
199199
int max);
200200
void (*recover_commit_reqs) (struct list_head *list,
201201
struct nfs_commit_info *cinfo);
202-
struct nfs_page * (*search_commit_reqs)(struct nfs_commit_info *cinfo,
203-
struct folio *folio);
204202
};
205203

206204
struct pnfs_layout_hdr {
@@ -409,8 +407,6 @@ void pnfs_generic_prepare_to_resend_writes(struct nfs_commit_data *data);
409407
void pnfs_generic_rw_release(void *data);
410408
void pnfs_generic_recover_commit_reqs(struct list_head *dst,
411409
struct nfs_commit_info *cinfo);
412-
struct nfs_page *pnfs_generic_search_commit_reqs(struct nfs_commit_info *cinfo,
413-
struct folio *folio);
414410
int pnfs_generic_commit_pagelist(struct inode *inode,
415411
struct list_head *mds_pages,
416412
int how,
@@ -570,17 +566,6 @@ pnfs_recover_commit_reqs(struct list_head *head, struct nfs_commit_info *cinfo)
570566
fl_cinfo->ops->recover_commit_reqs(head, cinfo);
571567
}
572568

573-
static inline struct nfs_page *
574-
pnfs_search_commit_reqs(struct inode *inode, struct nfs_commit_info *cinfo,
575-
struct folio *folio)
576-
{
577-
struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
578-
579-
if (!fl_cinfo->ops || !fl_cinfo->ops->search_commit_reqs)
580-
return NULL;
581-
return fl_cinfo->ops->search_commit_reqs(cinfo, folio);
582-
}
583-
584569
/* Should the pNFS client commit and return the layout upon a setattr */
585570
static inline bool
586571
pnfs_ld_layoutret_on_setattr(struct inode *inode)
@@ -882,13 +867,6 @@ pnfs_recover_commit_reqs(struct list_head *head, struct nfs_commit_info *cinfo)
882867
{
883868
}
884869

885-
static inline struct nfs_page *
886-
pnfs_search_commit_reqs(struct inode *inode, struct nfs_commit_info *cinfo,
887-
struct folio *folio)
888-
{
889-
return NULL;
890-
}
891-
892870
static inline int pnfs_layoutcommit_inode(struct inode *inode, bool sync)
893871
{
894872
return 0;

fs/nfs/pnfs_nfs.c

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -351,53 +351,6 @@ void pnfs_generic_recover_commit_reqs(struct list_head *dst,
351351
}
352352
EXPORT_SYMBOL_GPL(pnfs_generic_recover_commit_reqs);
353353

354-
static struct nfs_page *
355-
pnfs_bucket_search_commit_reqs(struct pnfs_commit_bucket *buckets,
356-
unsigned int nbuckets, struct folio *folio)
357-
{
358-
struct nfs_page *req;
359-
struct pnfs_commit_bucket *b;
360-
unsigned int i;
361-
362-
/* Linearly search the commit lists for each bucket until a matching
363-
* request is found */
364-
for (i = 0, b = buckets; i < nbuckets; i++, b++) {
365-
list_for_each_entry(req, &b->written, wb_list) {
366-
if (nfs_page_to_folio(req) == folio)
367-
return req->wb_head;
368-
}
369-
list_for_each_entry(req, &b->committing, wb_list) {
370-
if (nfs_page_to_folio(req) == folio)
371-
return req->wb_head;
372-
}
373-
}
374-
return NULL;
375-
}
376-
377-
/* pnfs_generic_search_commit_reqs - Search lists in @cinfo for the head request
378-
* for @folio
379-
* @cinfo - commit info for current inode
380-
* @folio - page to search for matching head request
381-
*
382-
* Return: the head request if one is found, otherwise %NULL.
383-
*/
384-
struct nfs_page *pnfs_generic_search_commit_reqs(struct nfs_commit_info *cinfo,
385-
struct folio *folio)
386-
{
387-
struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
388-
struct pnfs_commit_array *array;
389-
struct nfs_page *req;
390-
391-
list_for_each_entry(array, &fl_cinfo->commits, cinfo_list) {
392-
req = pnfs_bucket_search_commit_reqs(array->buckets,
393-
array->nbuckets, folio);
394-
if (req)
395-
return req;
396-
}
397-
return NULL;
398-
}
399-
EXPORT_SYMBOL_GPL(pnfs_generic_search_commit_reqs);
400-
401354
static struct pnfs_layout_segment *
402355
pnfs_bucket_get_committing(struct list_head *head,
403356
struct pnfs_commit_bucket *bucket,

fs/nfs/read.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ int nfs_read_add_folio(struct nfs_pageio_descriptor *pgio,
289289
struct nfs_open_context *ctx,
290290
struct folio *folio)
291291
{
292-
struct inode *inode = folio_file_mapping(folio)->host;
292+
struct inode *inode = folio->mapping->host;
293293
struct nfs_server *server = NFS_SERVER(inode);
294294
size_t fsize = folio_size(folio);
295295
unsigned int rsize = server->rsize;

0 commit comments

Comments
 (0)