Skip to content

Commit

Permalink
NFS: Rename fscache read and write pages functions
Browse files Browse the repository at this point in the history
Rename NFS fscache functions in a more consistent fashion
to better reflect when we read from and write to fscache.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
  • Loading branch information
DaveWysochanskiRH authored and Trond Myklebust committed Mar 13, 2022
1 parent 45f3a70 commit fc1c5ab
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 22 deletions.
6 changes: 3 additions & 3 deletions fs/nfs/fscache.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ static int fscache_fallback_write_page(struct inode *inode, struct page *page,
/*
* Retrieve a page from fscache
*/
int __nfs_readpage_from_fscache(struct inode *inode, struct page *page)
int __nfs_fscache_read_page(struct inode *inode, struct page *page)
{
int ret;

Expand Down Expand Up @@ -351,7 +351,7 @@ int __nfs_readpage_from_fscache(struct inode *inode, struct page *page)
* Store a newly fetched page in fscache. We can be certain there's no page
* stored in the cache as yet otherwise we would've read it from there.
*/
void __nfs_readpage_to_fscache(struct inode *inode, struct page *page)
void __nfs_fscache_write_page(struct inode *inode, struct page *page)
{
int ret;

Expand All @@ -362,7 +362,7 @@ void __nfs_readpage_to_fscache(struct inode *inode, struct page *page)
ret = fscache_fallback_write_page(inode, page, true);

dfprintk(FSCACHE,
"NFS: readpage_to_fscache: p:%p(i:%lu f:%lx) ret %d\n",
"NFS: nfs_fscache_write_page: p:%p(i:%lu f:%lx) ret %d\n",
page, page->index, page->flags, ret);

if (ret != 0) {
Expand Down
27 changes: 10 additions & 17 deletions fs/nfs/fscache.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ extern void nfs_fscache_clear_inode(struct inode *);
extern void nfs_fscache_open_file(struct inode *, struct file *);
extern void nfs_fscache_release_file(struct inode *, struct file *);

extern int __nfs_readpage_from_fscache(struct inode *, struct page *);
extern void __nfs_read_completion_to_fscache(struct nfs_pgio_header *hdr,
unsigned long bytes);
extern void __nfs_readpage_to_fscache(struct inode *, struct page *);
extern int __nfs_fscache_read_page(struct inode *, struct page *);
extern void __nfs_fscache_write_page(struct inode *, struct page *);

static inline int nfs_fscache_release_page(struct page *page, gfp_t gfp)
{
Expand All @@ -66,23 +64,22 @@ static inline int nfs_fscache_release_page(struct page *page, gfp_t gfp)
/*
* Retrieve a page from an inode data storage object.
*/
static inline int nfs_readpage_from_fscache(struct inode *inode,
struct page *page)
static inline int nfs_fscache_read_page(struct inode *inode, struct page *page)
{
if (NFS_I(inode)->fscache)
return __nfs_readpage_from_fscache(inode, page);
if (nfs_i_fscache(inode))
return __nfs_fscache_read_page(inode, page);
return -ENOBUFS;
}

/*
* Store a page newly fetched from the server in an inode data storage object
* in the cache.
*/
static inline void nfs_readpage_to_fscache(struct inode *inode,
static inline void nfs_fscache_write_page(struct inode *inode,
struct page *page)
{
if (NFS_I(inode)->fscache)
__nfs_readpage_to_fscache(inode, page);
if (nfs_i_fscache(inode))
__nfs_fscache_write_page(inode, page);
}

static inline void nfs_fscache_update_auxdata(struct nfs_fscache_inode_auxdata *auxdata,
Expand Down Expand Up @@ -136,15 +133,11 @@ static inline int nfs_fscache_release_page(struct page *page, gfp_t gfp)
{
return 1; /* True: may release page */
}
static inline int nfs_readpage_from_fscache(struct inode *inode,
struct page *page)
static inline int nfs_fscache_read_page(struct inode *inode, struct page *page)
{
return -ENOBUFS;
}
static inline void nfs_readpage_to_fscache(struct inode *inode,
struct page *page) {}


static inline void nfs_fscache_write_page(struct inode *inode, struct page *page) {}
static inline void nfs_fscache_invalidate(struct inode *inode, int flags) {}

static inline const char *nfs_server_fscache_state(struct nfs_server *server)
Expand Down
4 changes: 2 additions & 2 deletions fs/nfs/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static void nfs_readpage_release(struct nfs_page *req, int error)
struct address_space *mapping = page_file_mapping(page);

if (PageUptodate(page))
nfs_readpage_to_fscache(inode, page);
nfs_fscache_write_page(inode, page);
else if (!PageError(page) && !PagePrivate(page))
generic_error_remove_page(mapping, page);
unlock_page(page);
Expand Down Expand Up @@ -305,7 +305,7 @@ readpage_async_filler(struct nfs_readdesc *desc, struct page *page)
aligned_len = min_t(unsigned int, ALIGN(len, rsize), PAGE_SIZE);

if (!IS_SYNC(page->mapping->host)) {
error = nfs_readpage_from_fscache(page->mapping->host, page);
error = nfs_fscache_read_page(page->mapping->host, page);
if (error == 0)
goto out_unlock;
}
Expand Down

0 comments on commit fc1c5ab

Please sign in to comment.