nfs: remove unused writeverf code
authorWeston Andros Adamson <dros@primarydata.com>
Mon, 9 Jun 2014 15:48:36 +0000 (11:48 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 24 Jun 2014 22:47:00 +0000 (18:47 -0400)
Remove duplicate writeverf structure from merge of nfs_pgio_header and
nfs_pgio_data and remove writeverf related flags and logic to handle
more than one RPC per nfs_pgio_header.

Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/blocklayout/blocklayout.c
fs/nfs/direct.c
fs/nfs/internal.h
fs/nfs/objlayout/objlayout.c
fs/nfs/pagelist.c
fs/nfs/write.c
include/linux/nfs_xdr.h

index c3ccfe440390282d83234eabef5a4656c1e2d694..04ac32b339f8c03572ac36df400f32c2db42995d 100644 (file)
@@ -445,7 +445,7 @@ static void bl_end_par_io_write(void *data, int num_se)
        }
 
        hdr->task.tk_status = hdr->pnfs_error;
-       hdr->writeverf.committed = NFS_FILE_SYNC;
+       hdr->verf.committed = NFS_FILE_SYNC;
        INIT_WORK(&hdr->task.u.tk_work, bl_write_cleanup);
        schedule_work(&hdr->task.u.tk_work);
 }
index 6c4c867ee04cbaa353c7a96cd80cfdb7ce95b2ae..2a3293a5dda01e65e6c9c81f35e7f2768df042a2 100644 (file)
@@ -715,7 +715,7 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
 {
        struct nfs_direct_req *dreq = hdr->dreq;
        struct nfs_commit_info cinfo;
-       int bit = -1;
+       bool request_commit = false;
        struct nfs_page *req = nfs_list_entry(hdr->pages.next);
 
        if (test_bit(NFS_IOHDR_REDO, &hdr->flags))
@@ -729,27 +729,20 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
                dreq->flags = 0;
                dreq->error = hdr->error;
        }
-       if (dreq->error != 0)
-               bit = NFS_IOHDR_ERROR;
-       else {
+       if (dreq->error == 0) {
                dreq->count += hdr->good_bytes;
-               if (test_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags)) {
-                       dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
-                       bit = NFS_IOHDR_NEED_RESCHED;
-               } else if (test_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags)) {
+               if (nfs_write_need_commit(hdr)) {
                        if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES)
-                               bit = NFS_IOHDR_NEED_RESCHED;
+                               request_commit = true;
                        else if (dreq->flags == 0) {
                                nfs_direct_set_hdr_verf(dreq, hdr);
-                               bit = NFS_IOHDR_NEED_COMMIT;
+                               request_commit = true;
                                dreq->flags = NFS_ODIRECT_DO_COMMIT;
                        } else if (dreq->flags == NFS_ODIRECT_DO_COMMIT) {
-                               if (nfs_direct_set_or_cmp_hdr_verf(dreq, hdr)) {
+                               request_commit = true;
+                               if (nfs_direct_set_or_cmp_hdr_verf(dreq, hdr))
                                        dreq->flags =
                                                NFS_ODIRECT_RESCHED_WRITES;
-                                       bit = NFS_IOHDR_NEED_RESCHED;
-                               } else
-                                       bit = NFS_IOHDR_NEED_COMMIT;
                        }
                }
        }
@@ -760,9 +753,7 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
 
                req = nfs_list_entry(hdr->pages.next);
                nfs_list_remove_request(req);
-               switch (bit) {
-               case NFS_IOHDR_NEED_RESCHED:
-               case NFS_IOHDR_NEED_COMMIT:
+               if (request_commit) {
                        kref_get(&req->wb_kref);
                        nfs_mark_request_commit(req, hdr->lseg, &cinfo);
                        do_destroy = false;
index 3f3aedd2e8c97035e933b7fff70095ac61b30ebe..da36257628c590238ad120190fe4fe3e3a81a057 100644 (file)
@@ -441,6 +441,7 @@ int nfs_scan_commit(struct inode *inode, struct list_head *dst,
 void nfs_mark_request_commit(struct nfs_page *req,
                             struct pnfs_layout_segment *lseg,
                             struct nfs_commit_info *cinfo);
+int nfs_write_need_commit(struct nfs_pgio_header *);
 int nfs_generic_commit_list(struct inode *inode, struct list_head *head,
                            int how, struct nfs_commit_info *cinfo);
 void nfs_retry_commit(struct list_head *page_list,
index 86312787cee66490728dd707fcd141d27f657a32..697a16d11fac3204b0574c084965662988626f88 100644 (file)
@@ -328,7 +328,7 @@ objlayout_write_done(struct objlayout_io_res *oir, ssize_t status, bool sync)
        oir->status = hdr->task.tk_status = status;
        if (status >= 0) {
                hdr->res.count = status;
-               hdr->writeverf.committed = oir->committed;
+               hdr->verf.committed = oir->committed;
        } else {
                hdr->pnfs_error = status;
        }
@@ -336,7 +336,7 @@ objlayout_write_done(struct objlayout_io_res *oir, ssize_t status, bool sync)
        /* must not use oir after this point */
 
        dprintk("%s: Return status %zd committed %d sync=%d\n", __func__,
-               status, hdr->writeverf.committed, sync);
+               status, hdr->verf.committed, sync);
 
        if (sync)
                pnfs_ld_write_done(hdr);
index ecb3d4cdbc854d257761d19bcb00604051660cf0..7dd0d5f101a40b1fd71be9115aa0e3fab5341082 100644 (file)
@@ -545,7 +545,7 @@ static void nfs_pgio_rpcsetup(struct nfs_pgio_header *hdr,
        hdr->res.fattr   = &hdr->fattr;
        hdr->res.count   = count;
        hdr->res.eof     = 0;
-       hdr->res.verf    = &hdr->writeverf;
+       hdr->res.verf    = &hdr->verf;
        nfs_fattr_init(&hdr->fattr);
 }
 
index 6a2d0986a3a326c8f0ba5003dd359f926c0a05b8..8534ee5c207d2e9a5c6194bcd37836a43fd556a3 100644 (file)
@@ -595,12 +595,11 @@ nfs_clear_request_commit(struct nfs_page *req)
        }
 }
 
-static inline
 int nfs_write_need_commit(struct nfs_pgio_header *hdr)
 {
-       if (hdr->writeverf.committed == NFS_DATA_SYNC)
+       if (hdr->verf.committed == NFS_DATA_SYNC)
                return hdr->lseg == NULL;
-       return hdr->writeverf.committed != NFS_FILE_SYNC;
+       return hdr->verf.committed != NFS_FILE_SYNC;
 }
 
 #else
@@ -626,7 +625,6 @@ nfs_clear_request_commit(struct nfs_page *req)
 {
 }
 
-static inline
 int nfs_write_need_commit(struct nfs_pgio_header *hdr)
 {
        return 0;
@@ -654,11 +652,7 @@ static void nfs_write_completion(struct nfs_pgio_header *hdr)
                        nfs_context_set_write_error(req->wb_context, hdr->error);
                        goto remove_req;
                }
-               if (test_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags)) {
-                       nfs_mark_request_dirty(req);
-                       goto next;
-               }
-               if (test_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags)) {
+               if (nfs_write_need_commit(hdr)) {
                        memcpy(&req->wb_verf, &hdr->verf.verifier, sizeof(req->wb_verf));
                        nfs_mark_request_commit(req, hdr->lseg, &cinfo);
                        goto next;
@@ -668,7 +662,7 @@ remove_req:
 next:
                nfs_unlock_request(req);
                nfs_end_page_writeback(req);
-               do_destroy = !test_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags);
+               do_destroy = !nfs_write_need_commit(hdr);
                nfs_release_request(req);
        }
 out:
@@ -1088,18 +1082,7 @@ void nfs_commit_prepare(struct rpc_task *task, void *calldata)
 
 static void nfs_writeback_release_common(struct nfs_pgio_header *hdr)
 {
-       int status = hdr->task.tk_status;
-
-       if ((status >= 0) && nfs_write_need_commit(hdr)) {
-               spin_lock(&hdr->lock);
-               if (test_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags))
-                       ; /* Do nothing */
-               else if (!test_and_set_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags))
-                       memcpy(&hdr->verf, &hdr->writeverf, sizeof(hdr->verf));
-               else if (memcmp(&hdr->verf, &hdr->writeverf, sizeof(hdr->verf)))
-                       set_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags);
-               spin_unlock(&hdr->lock);
-       }
+       /* do nothing! */
 }
 
 /*
index efeaf7690b51a837493176c0b99aaa9a171f1bef..e1b7b3b7c40f73da4c6148bbde0a8bc6fe7726a2 100644 (file)
@@ -1253,8 +1253,6 @@ enum {
        NFS_IOHDR_ERROR = 0,
        NFS_IOHDR_EOF,
        NFS_IOHDR_REDO,
-       NFS_IOHDR_NEED_COMMIT,
-       NFS_IOHDR_NEED_RESCHED,
 };
 
 struct nfs_pgio_header {
@@ -1284,7 +1282,6 @@ struct nfs_pgio_header {
         */
        struct rpc_task         task;
        struct nfs_fattr        fattr;
-       struct nfs_writeverf    writeverf;      /* Used for writes */
        struct nfs_pgio_args    args;           /* argument struct */
        struct nfs_pgio_res     res;            /* result struct */
        unsigned long           timestamp;      /* For lease renewal */