Commit 7e8e78a0 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Anna Schumaker

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 4840c000
...@@ -427,7 +427,7 @@ static int nfs_write_end(struct file *file, struct address_space *mapping, ...@@ -427,7 +427,7 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,
static void nfs_invalidate_folio(struct folio *folio, size_t offset, static void nfs_invalidate_folio(struct folio *folio, size_t offset,
size_t length) size_t length)
{ {
struct inode *inode = folio_file_mapping(folio)->host; struct inode *inode = folio->mapping->host;
dfprintk(PAGECACHE, "NFS: invalidate_folio(%lu, %zu, %zu)\n", dfprintk(PAGECACHE, "NFS: invalidate_folio(%lu, %zu, %zu)\n",
folio->index, offset, length); folio->index, offset, length);
...@@ -454,7 +454,7 @@ static bool nfs_release_folio(struct folio *folio, gfp_t gfp) ...@@ -454,7 +454,7 @@ static bool nfs_release_folio(struct folio *folio, gfp_t gfp)
if ((current_gfp_context(gfp) & GFP_KERNEL) != GFP_KERNEL || if ((current_gfp_context(gfp) & GFP_KERNEL) != GFP_KERNEL ||
current_is_kswapd()) current_is_kswapd())
return false; return false;
if (nfs_wb_folio(folio_file_mapping(folio)->host, folio) < 0) if (nfs_wb_folio(folio->mapping->host, folio) < 0)
return false; return false;
} }
return nfs_fscache_release_folio(folio, gfp); return nfs_fscache_release_folio(folio, gfp);
...@@ -606,7 +606,7 @@ static vm_fault_t nfs_vm_page_mkwrite(struct vm_fault *vmf) ...@@ -606,7 +606,7 @@ static vm_fault_t nfs_vm_page_mkwrite(struct vm_fault *vmf)
TASK_KILLABLE|TASK_FREEZABLE_UNSAFE); TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
folio_lock(folio); folio_lock(folio);
mapping = folio_file_mapping(folio); mapping = folio->mapping;
if (mapping != inode->i_mapping) if (mapping != inode->i_mapping)
goto out_unlock; goto out_unlock;
......
...@@ -1110,7 +1110,6 @@ static const struct pnfs_commit_ops filelayout_commit_ops = { ...@@ -1110,7 +1110,6 @@ static const struct pnfs_commit_ops filelayout_commit_ops = {
.clear_request_commit = pnfs_generic_clear_request_commit, .clear_request_commit = pnfs_generic_clear_request_commit,
.scan_commit_lists = pnfs_generic_scan_commit_lists, .scan_commit_lists = pnfs_generic_scan_commit_lists,
.recover_commit_reqs = pnfs_generic_recover_commit_reqs, .recover_commit_reqs = pnfs_generic_recover_commit_reqs,
.search_commit_reqs = pnfs_generic_search_commit_reqs,
.commit_pagelist = filelayout_commit_pagelist, .commit_pagelist = filelayout_commit_pagelist,
}; };
......
...@@ -341,7 +341,7 @@ void nfs_netfs_initiate_read(struct nfs_pgio_header *hdr) ...@@ -341,7 +341,7 @@ void nfs_netfs_initiate_read(struct nfs_pgio_header *hdr)
int nfs_netfs_folio_unlock(struct folio *folio) int nfs_netfs_folio_unlock(struct folio *folio)
{ {
struct inode *inode = folio_file_mapping(folio)->host; struct inode *inode = folio->mapping->host;
/* /*
* If fscache is enabled, netfs will unlock pages. * If fscache is enabled, netfs will unlock pages.
......
...@@ -785,7 +785,7 @@ static inline void nfs_folio_mark_unstable(struct folio *folio, ...@@ -785,7 +785,7 @@ static inline void nfs_folio_mark_unstable(struct folio *folio,
struct nfs_commit_info *cinfo) struct nfs_commit_info *cinfo)
{ {
if (folio && !cinfo->dreq) { if (folio && !cinfo->dreq) {
struct inode *inode = folio_file_mapping(folio)->host; struct inode *inode = folio->mapping->host;
long nr = folio_nr_pages(folio); long nr = folio_nr_pages(folio);
/* This page is really still in write-back - just that the /* 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, ...@@ -803,7 +803,7 @@ static inline void nfs_folio_mark_unstable(struct folio *folio,
static inline static inline
unsigned int nfs_page_length(struct page *page) unsigned int nfs_page_length(struct page *page)
{ {
loff_t i_size = i_size_read(page_file_mapping(page)->host); loff_t i_size = i_size_read(page->mapping->host);
if (i_size > 0) { if (i_size > 0) {
pgoff_t index = page_index(page); pgoff_t index = page_index(page);
...@@ -821,10 +821,10 @@ unsigned int nfs_page_length(struct page *page) ...@@ -821,10 +821,10 @@ unsigned int nfs_page_length(struct page *page)
*/ */
static inline size_t nfs_folio_length(struct folio *folio) static inline size_t nfs_folio_length(struct folio *folio)
{ {
loff_t i_size = i_size_read(folio_file_mapping(folio)->host); loff_t i_size = i_size_read(folio->mapping->host);
if (i_size > 0) { if (i_size > 0) {
pgoff_t index = folio_index(folio) >> folio_order(folio); pgoff_t index = folio->index >> folio_order(folio);
pgoff_t end_index = (i_size - 1) >> folio_shift(folio); pgoff_t end_index = (i_size - 1) >> folio_shift(folio);
if (index < end_index) if (index < end_index)
return folio_size(folio); return folio_size(folio);
......
...@@ -569,7 +569,7 @@ struct nfs_page *nfs_page_create_from_folio(struct nfs_open_context *ctx, ...@@ -569,7 +569,7 @@ struct nfs_page *nfs_page_create_from_folio(struct nfs_open_context *ctx,
if (IS_ERR(l_ctx)) if (IS_ERR(l_ctx))
return ERR_CAST(l_ctx); return ERR_CAST(l_ctx);
ret = nfs_page_create(l_ctx, offset, folio_index(folio), offset, count); ret = nfs_page_create(l_ctx, offset, folio->index, offset, count);
if (!IS_ERR(ret)) { if (!IS_ERR(ret)) {
nfs_page_assign_folio(ret, folio); nfs_page_assign_folio(ret, folio);
nfs_page_group_init(ret, NULL); nfs_page_group_init(ret, NULL);
......
...@@ -199,8 +199,6 @@ struct pnfs_commit_ops { ...@@ -199,8 +199,6 @@ struct pnfs_commit_ops {
int max); int max);
void (*recover_commit_reqs) (struct list_head *list, void (*recover_commit_reqs) (struct list_head *list,
struct nfs_commit_info *cinfo); struct nfs_commit_info *cinfo);
struct nfs_page * (*search_commit_reqs)(struct nfs_commit_info *cinfo,
struct folio *folio);
}; };
struct pnfs_layout_hdr { struct pnfs_layout_hdr {
...@@ -409,8 +407,6 @@ void pnfs_generic_prepare_to_resend_writes(struct nfs_commit_data *data); ...@@ -409,8 +407,6 @@ void pnfs_generic_prepare_to_resend_writes(struct nfs_commit_data *data);
void pnfs_generic_rw_release(void *data); void pnfs_generic_rw_release(void *data);
void pnfs_generic_recover_commit_reqs(struct list_head *dst, void pnfs_generic_recover_commit_reqs(struct list_head *dst,
struct nfs_commit_info *cinfo); struct nfs_commit_info *cinfo);
struct nfs_page *pnfs_generic_search_commit_reqs(struct nfs_commit_info *cinfo,
struct folio *folio);
int pnfs_generic_commit_pagelist(struct inode *inode, int pnfs_generic_commit_pagelist(struct inode *inode,
struct list_head *mds_pages, struct list_head *mds_pages,
int how, int how,
...@@ -570,17 +566,6 @@ pnfs_recover_commit_reqs(struct list_head *head, struct nfs_commit_info *cinfo) ...@@ -570,17 +566,6 @@ pnfs_recover_commit_reqs(struct list_head *head, struct nfs_commit_info *cinfo)
fl_cinfo->ops->recover_commit_reqs(head, cinfo); fl_cinfo->ops->recover_commit_reqs(head, cinfo);
} }
static inline struct nfs_page *
pnfs_search_commit_reqs(struct inode *inode, struct nfs_commit_info *cinfo,
struct folio *folio)
{
struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
if (!fl_cinfo->ops || !fl_cinfo->ops->search_commit_reqs)
return NULL;
return fl_cinfo->ops->search_commit_reqs(cinfo, folio);
}
/* Should the pNFS client commit and return the layout upon a setattr */ /* Should the pNFS client commit and return the layout upon a setattr */
static inline bool static inline bool
pnfs_ld_layoutret_on_setattr(struct inode *inode) 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) ...@@ -882,13 +867,6 @@ pnfs_recover_commit_reqs(struct list_head *head, struct nfs_commit_info *cinfo)
{ {
} }
static inline struct nfs_page *
pnfs_search_commit_reqs(struct inode *inode, struct nfs_commit_info *cinfo,
struct folio *folio)
{
return NULL;
}
static inline int pnfs_layoutcommit_inode(struct inode *inode, bool sync) static inline int pnfs_layoutcommit_inode(struct inode *inode, bool sync)
{ {
return 0; return 0;
......
...@@ -351,53 +351,6 @@ void pnfs_generic_recover_commit_reqs(struct list_head *dst, ...@@ -351,53 +351,6 @@ void pnfs_generic_recover_commit_reqs(struct list_head *dst,
} }
EXPORT_SYMBOL_GPL(pnfs_generic_recover_commit_reqs); EXPORT_SYMBOL_GPL(pnfs_generic_recover_commit_reqs);
static struct nfs_page *
pnfs_bucket_search_commit_reqs(struct pnfs_commit_bucket *buckets,
unsigned int nbuckets, struct folio *folio)
{
struct nfs_page *req;
struct pnfs_commit_bucket *b;
unsigned int i;
/* Linearly search the commit lists for each bucket until a matching
* request is found */
for (i = 0, b = buckets; i < nbuckets; i++, b++) {
list_for_each_entry(req, &b->written, wb_list) {
if (nfs_page_to_folio(req) == folio)
return req->wb_head;
}
list_for_each_entry(req, &b->committing, wb_list) {
if (nfs_page_to_folio(req) == folio)
return req->wb_head;
}
}
return NULL;
}
/* pnfs_generic_search_commit_reqs - Search lists in @cinfo for the head request
* for @folio
* @cinfo - commit info for current inode
* @folio - page to search for matching head request
*
* Return: the head request if one is found, otherwise %NULL.
*/
struct nfs_page *pnfs_generic_search_commit_reqs(struct nfs_commit_info *cinfo,
struct folio *folio)
{
struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
struct pnfs_commit_array *array;
struct nfs_page *req;
list_for_each_entry(array, &fl_cinfo->commits, cinfo_list) {
req = pnfs_bucket_search_commit_reqs(array->buckets,
array->nbuckets, folio);
if (req)
return req;
}
return NULL;
}
EXPORT_SYMBOL_GPL(pnfs_generic_search_commit_reqs);
static struct pnfs_layout_segment * static struct pnfs_layout_segment *
pnfs_bucket_get_committing(struct list_head *head, pnfs_bucket_get_committing(struct list_head *head,
struct pnfs_commit_bucket *bucket, struct pnfs_commit_bucket *bucket,
......
...@@ -289,7 +289,7 @@ int nfs_read_add_folio(struct nfs_pageio_descriptor *pgio, ...@@ -289,7 +289,7 @@ int nfs_read_add_folio(struct nfs_pageio_descriptor *pgio,
struct nfs_open_context *ctx, struct nfs_open_context *ctx,
struct folio *folio) struct folio *folio)
{ {
struct inode *inode = folio_file_mapping(folio)->host; struct inode *inode = folio->mapping->host;
struct nfs_server *server = NFS_SERVER(inode); struct nfs_server *server = NFS_SERVER(inode);
size_t fsize = folio_size(folio); size_t fsize = folio_size(folio);
unsigned int rsize = server->rsize; unsigned int rsize = server->rsize;
......
This diff is collapsed.
...@@ -208,8 +208,8 @@ static inline struct inode *nfs_page_to_inode(const struct nfs_page *req) ...@@ -208,8 +208,8 @@ static inline struct inode *nfs_page_to_inode(const struct nfs_page *req)
struct folio *folio = nfs_page_to_folio(req); struct folio *folio = nfs_page_to_folio(req);
if (folio == NULL) if (folio == NULL)
return page_file_mapping(req->wb_page)->host; return req->wb_page->mapping->host;
return folio_file_mapping(folio)->host; return folio->mapping->host;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment