Skip to content

Commit c65e625

Browse files
westonandrosadamsontrondmypd
authored andcommitted
nfs: remove unused writeverf code
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>
1 parent d45f60c commit c65e625

7 files changed

Lines changed: 18 additions & 46 deletions

File tree

‎fs/nfs/blocklayout/blocklayout.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ static void bl_end_par_io_write(void *data, int num_se)
445445
}
446446

447447
hdr->task.tk_status = hdr->pnfs_error;
448-
hdr->writeverf.committed = NFS_FILE_SYNC;
448+
hdr->verf.committed = NFS_FILE_SYNC;
449449
INIT_WORK(&hdr->task.u.tk_work, bl_write_cleanup);
450450
schedule_work(&hdr->task.u.tk_work);
451451
}

‎fs/nfs/direct.c‎

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
715715
{
716716
struct nfs_direct_req *dreq = hdr->dreq;
717717
struct nfs_commit_info cinfo;
718-
int bit = -1;
718+
bool request_commit = false;
719719
struct nfs_page *req = nfs_list_entry(hdr->pages.next);
720720

721721
if (test_bit(NFS_IOHDR_REDO, &hdr->flags))
@@ -729,27 +729,20 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
729729
dreq->flags = 0;
730730
dreq->error = hdr->error;
731731
}
732-
if (dreq->error != 0)
733-
bit = NFS_IOHDR_ERROR;
734-
else {
732+
if (dreq->error == 0) {
735733
dreq->count += hdr->good_bytes;
736-
if (test_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags)) {
737-
dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
738-
bit = NFS_IOHDR_NEED_RESCHED;
739-
} else if (test_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags)) {
734+
if (nfs_write_need_commit(hdr)) {
740735
if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES)
741-
bit = NFS_IOHDR_NEED_RESCHED;
736+
request_commit = true;
742737
else if (dreq->flags == 0) {
743738
nfs_direct_set_hdr_verf(dreq, hdr);
744-
bit = NFS_IOHDR_NEED_COMMIT;
739+
request_commit = true;
745740
dreq->flags = NFS_ODIRECT_DO_COMMIT;
746741
} else if (dreq->flags == NFS_ODIRECT_DO_COMMIT) {
747-
if (nfs_direct_set_or_cmp_hdr_verf(dreq, hdr)) {
742+
request_commit = true;
743+
if (nfs_direct_set_or_cmp_hdr_verf(dreq, hdr))
748744
dreq->flags =
749745
NFS_ODIRECT_RESCHED_WRITES;
750-
bit = NFS_IOHDR_NEED_RESCHED;
751-
} else
752-
bit = NFS_IOHDR_NEED_COMMIT;
753746
}
754747
}
755748
}
@@ -760,9 +753,7 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
760753

761754
req = nfs_list_entry(hdr->pages.next);
762755
nfs_list_remove_request(req);
763-
switch (bit) {
764-
case NFS_IOHDR_NEED_RESCHED:
765-
case NFS_IOHDR_NEED_COMMIT:
756+
if (request_commit) {
766757
kref_get(&req->wb_kref);
767758
nfs_mark_request_commit(req, hdr->lseg, &cinfo);
768759
do_destroy = false;

‎fs/nfs/internal.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ int nfs_scan_commit(struct inode *inode, struct list_head *dst,
441441
void nfs_mark_request_commit(struct nfs_page *req,
442442
struct pnfs_layout_segment *lseg,
443443
struct nfs_commit_info *cinfo);
444+
int nfs_write_need_commit(struct nfs_pgio_header *);
444445
int nfs_generic_commit_list(struct inode *inode, struct list_head *head,
445446
int how, struct nfs_commit_info *cinfo);
446447
void nfs_retry_commit(struct list_head *page_list,

‎fs/nfs/objlayout/objlayout.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,15 +328,15 @@ objlayout_write_done(struct objlayout_io_res *oir, ssize_t status, bool sync)
328328
oir->status = hdr->task.tk_status = status;
329329
if (status >= 0) {
330330
hdr->res.count = status;
331-
hdr->writeverf.committed = oir->committed;
331+
hdr->verf.committed = oir->committed;
332332
} else {
333333
hdr->pnfs_error = status;
334334
}
335335
objlayout_iodone(oir);
336336
/* must not use oir after this point */
337337

338338
dprintk("%s: Return status %zd committed %d sync=%d\n", __func__,
339-
status, hdr->writeverf.committed, sync);
339+
status, hdr->verf.committed, sync);
340340

341341
if (sync)
342342
pnfs_ld_write_done(hdr);

‎fs/nfs/pagelist.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ static void nfs_pgio_rpcsetup(struct nfs_pgio_header *hdr,
545545
hdr->res.fattr = &hdr->fattr;
546546
hdr->res.count = count;
547547
hdr->res.eof = 0;
548-
hdr->res.verf = &hdr->writeverf;
548+
hdr->res.verf = &hdr->verf;
549549
nfs_fattr_init(&hdr->fattr);
550550
}
551551

‎fs/nfs/write.c‎

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -595,12 +595,11 @@ nfs_clear_request_commit(struct nfs_page *req)
595595
}
596596
}
597597

598-
static inline
599598
int nfs_write_need_commit(struct nfs_pgio_header *hdr)
600599
{
601-
if (hdr->writeverf.committed == NFS_DATA_SYNC)
600+
if (hdr->verf.committed == NFS_DATA_SYNC)
602601
return hdr->lseg == NULL;
603-
return hdr->writeverf.committed != NFS_FILE_SYNC;
602+
return hdr->verf.committed != NFS_FILE_SYNC;
604603
}
605604

606605
#else
@@ -626,7 +625,6 @@ nfs_clear_request_commit(struct nfs_page *req)
626625
{
627626
}
628627

629-
static inline
630628
int nfs_write_need_commit(struct nfs_pgio_header *hdr)
631629
{
632630
return 0;
@@ -654,11 +652,7 @@ static void nfs_write_completion(struct nfs_pgio_header *hdr)
654652
nfs_context_set_write_error(req->wb_context, hdr->error);
655653
goto remove_req;
656654
}
657-
if (test_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags)) {
658-
nfs_mark_request_dirty(req);
659-
goto next;
660-
}
661-
if (test_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags)) {
655+
if (nfs_write_need_commit(hdr)) {
662656
memcpy(&req->wb_verf, &hdr->verf.verifier, sizeof(req->wb_verf));
663657
nfs_mark_request_commit(req, hdr->lseg, &cinfo);
664658
goto next;
@@ -668,7 +662,7 @@ static void nfs_write_completion(struct nfs_pgio_header *hdr)
668662
next:
669663
nfs_unlock_request(req);
670664
nfs_end_page_writeback(req);
671-
do_destroy = !test_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags);
665+
do_destroy = !nfs_write_need_commit(hdr);
672666
nfs_release_request(req);
673667
}
674668
out:
@@ -1088,18 +1082,7 @@ void nfs_commit_prepare(struct rpc_task *task, void *calldata)
10881082

10891083
static void nfs_writeback_release_common(struct nfs_pgio_header *hdr)
10901084
{
1091-
int status = hdr->task.tk_status;
1092-
1093-
if ((status >= 0) && nfs_write_need_commit(hdr)) {
1094-
spin_lock(&hdr->lock);
1095-
if (test_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags))
1096-
; /* Do nothing */
1097-
else if (!test_and_set_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags))
1098-
memcpy(&hdr->verf, &hdr->writeverf, sizeof(hdr->verf));
1099-
else if (memcmp(&hdr->verf, &hdr->writeverf, sizeof(hdr->verf)))
1100-
set_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags);
1101-
spin_unlock(&hdr->lock);
1102-
}
1085+
/* do nothing! */
11031086
}
11041087

11051088
/*

‎include/linux/nfs_xdr.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,8 +1253,6 @@ enum {
12531253
NFS_IOHDR_ERROR = 0,
12541254
NFS_IOHDR_EOF,
12551255
NFS_IOHDR_REDO,
1256-
NFS_IOHDR_NEED_COMMIT,
1257-
NFS_IOHDR_NEED_RESCHED,
12581256
};
12591257

12601258
struct nfs_pgio_header {
@@ -1284,7 +1282,6 @@ struct nfs_pgio_header {
12841282
*/
12851283
struct rpc_task task;
12861284
struct nfs_fattr fattr;
1287-
struct nfs_writeverf writeverf; /* Used for writes */
12881285
struct nfs_pgio_args args; /* argument struct */
12891286
struct nfs_pgio_res res; /* result struct */
12901287
unsigned long timestamp; /* For lease renewal */

0 commit comments

Comments
 (0)