Skip to content

Commit

Permalink
NFS: Unconditionally enable commit code
Browse files Browse the repository at this point in the history
The goal is to create a generic NFS module with code that does not
depend on what versions of NFS are enabled.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
  • Loading branch information
Anna Schumaker authored and Trond Myklebust committed Sep 12, 2014
1 parent 164ae58 commit f418c64
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 83 deletions.
14 changes: 0 additions & 14 deletions fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ static int nfs_direct_set_or_cmp_hdr_verf(struct nfs_direct_req *dreq,
return memcmp(verfp, &hdr->verf, sizeof(struct nfs_writeverf));
}

#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
/*
* nfs_direct_cmp_commit_data_verf - compare verifier for commit data
* @dreq - direct request possibly spanning multiple servers
Expand All @@ -197,7 +196,6 @@ static int nfs_direct_cmp_commit_data_verf(struct nfs_direct_req *dreq,
WARN_ON_ONCE(verfp->committed < 0);
return memcmp(verfp, &data->verf, sizeof(struct nfs_writeverf));
}
#endif

/**
* nfs_direct_IO - NFS address space operation for direct I/O
Expand Down Expand Up @@ -576,7 +574,6 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter,
return result;
}

#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
{
struct nfs_pageio_descriptor desc;
Expand Down Expand Up @@ -700,17 +697,6 @@ static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode
schedule_work(&dreq->work); /* Calls nfs_direct_write_schedule_work */
}

#else
static void nfs_direct_write_schedule_work(struct work_struct *work)
{
}

static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode *inode)
{
nfs_direct_complete(dreq, true);
}
#endif

static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
{
struct nfs_direct_req *dreq = hdr->dreq;
Expand Down
61 changes: 0 additions & 61 deletions fs/nfs/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,6 @@ nfs_mark_request_dirty(struct nfs_page *req)
__set_page_dirty_nobuffers(req->wb_page);
}

#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
/*
* nfs_page_search_commits_for_head_request_locked
*
Expand Down Expand Up @@ -870,43 +869,6 @@ int nfs_write_need_commit(struct nfs_pgio_header *hdr)
return hdr->verf.committed != NFS_FILE_SYNC;
}

#else
static struct nfs_page *
nfs_page_search_commits_for_head_request_locked(struct nfs_inode *nfsi,
struct page *page)
{
return NULL;
}

static void nfs_init_cinfo_from_inode(struct nfs_commit_info *cinfo,
struct inode *inode)
{
}

void nfs_init_cinfo(struct nfs_commit_info *cinfo,
struct inode *inode,
struct nfs_direct_req *dreq)
{
}

void
nfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg,
struct nfs_commit_info *cinfo)
{
}

static void
nfs_clear_request_commit(struct nfs_page *req)
{
}

int nfs_write_need_commit(struct nfs_pgio_header *hdr)
{
return 0;
}

#endif

static void nfs_write_completion(struct nfs_pgio_header *hdr)
{
struct nfs_commit_info cinfo;
Expand Down Expand Up @@ -942,7 +904,6 @@ static void nfs_write_completion(struct nfs_pgio_header *hdr)
hdr->release(hdr);
}

#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
unsigned long
nfs_reqs_to_commit(struct nfs_commit_info *cinfo)
{
Expand Down Expand Up @@ -999,19 +960,6 @@ nfs_scan_commit(struct inode *inode, struct list_head *dst,
return ret;
}

#else
unsigned long nfs_reqs_to_commit(struct nfs_commit_info *cinfo)
{
return 0;
}

int nfs_scan_commit(struct inode *inode, struct list_head *dst,
struct nfs_commit_info *cinfo)
{
return 0;
}
#endif

/*
* Search for an existing write request, and attempt to update
* it to reflect a new dirty region on a given page.
Expand Down Expand Up @@ -1404,7 +1352,6 @@ static int nfs_writeback_done(struct rpc_task *task,
return status;
nfs_add_stats(inode, NFSIOS_SERVERWRITTENBYTES, hdr->res.count);

#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
if (hdr->res.verf->committed < hdr->args.stable &&
task->tk_status >= 0) {
/* We tried a write call, but the server did not
Expand All @@ -1426,7 +1373,6 @@ static int nfs_writeback_done(struct rpc_task *task,
complain = jiffies + 300 * HZ;
}
}
#endif

/* Deal with the suid/sgid bit corner case */
if (nfs_should_remove_suid(inode))
Expand Down Expand Up @@ -1479,7 +1425,6 @@ static void nfs_writeback_result(struct rpc_task *task,
}


#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
static int nfs_commit_set_lock(struct nfs_inode *nfsi, int may_wait)
{
int ret;
Expand Down Expand Up @@ -1803,12 +1748,6 @@ static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contr
__mark_inode_dirty(inode, I_DIRTY_DATASYNC);
return ret;
}
#else
static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_control *wbc)
{
return 0;
}
#endif

int nfs_write_inode(struct inode *inode, struct writeback_control *wbc)
{
Expand Down
8 changes: 0 additions & 8 deletions include/linux/nfs_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -529,17 +529,9 @@ extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned
extern int nfs_wb_all(struct inode *inode);
extern int nfs_wb_page(struct inode *inode, struct page* page);
extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
extern int nfs_commit_inode(struct inode *, int);
extern struct nfs_commit_data *nfs_commitdata_alloc(void);
extern void nfs_commit_free(struct nfs_commit_data *data);
#else
static inline int
nfs_commit_inode(struct inode *inode, int how)
{
return 0;
}
#endif

static inline int
nfs_have_writebacks(struct inode *inode)
Expand Down

0 comments on commit f418c64

Please sign in to comment.