Remove the unused bucket array in struct pnfs_ds_commit_info.
Unified · Split
| @@ -217,7 +217,6 @@ static void nfs_direct_req_free(struct kref *kref) · 216 unmodified lines | ||
| 217 | 217 | struct nfs_direct_req *dreq = container_of(kref, struct nfs_direct_req, kref); |
| 218 | 218 | |
| 219 | 219 | pnfs_release_ds_info(&dreq->ds_cinfo, dreq->inode); |
| 220 | − nfs_free_pnfs_ds_cinfo(&dreq->ds_cinfo); | |
| 221 | 220 | if (dreq->l_ctx != NULL) |
| 222 | 221 | nfs_put_lock_context(dreq->l_ctx); |
| 223 | 222 | if (dreq->ctx != NULL) |
| @@ -755,72 +755,12 @@ filelayout_free_lseg(struct pnfs_layout_segment *lseg) · 754 unmodified lines | ||
| 755 | 755 | flo = FILELAYOUT_FROM_HDR(lseg->pls_layout); |
| 756 | 756 | inode = flo->generic_hdr.plh_inode; |
| 757 | 757 | spin_lock(&inode->i_lock); |
| 758 | − flo->commit_info.nbuckets = 0; | |
| 759 | − kfree(flo->commit_info.buckets); | |
| 760 | − flo->commit_info.buckets = NULL; | |
| 761 | 758 | pnfs_generic_ds_cinfo_release_lseg(&flo->commit_info, lseg); |
| 762 | 759 | spin_unlock(&inode->i_lock); |
| 763 | 760 | } |
| 764 | 761 | _filelayout_free_lseg(fl); |
| 765 | 762 | } |
| 766 | 763 | |
| 767 | −static int | |
| 768 | −filelayout_alloc_commit_info(struct pnfs_layout_segment *lseg, | |
| 769 | − struct nfs_commit_info *cinfo, | |
| 770 | − gfp_t gfp_flags) | |
| 771 | −{ | |
| 772 | − struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg); | |
| 773 | − struct pnfs_commit_bucket *buckets; | |
| 774 | − int size, i; | |
| 775 | − | |
| 776 | − if (fl->commit_through_mds) | |
| 777 | − return 0; | |
| 778 | − | |
| 779 | − size = (fl->stripe_type == STRIPE_SPARSE) ? | |
| 780 | − fl->dsaddr->ds_num : fl->dsaddr->stripe_count; | |
| 781 | − | |
| 782 | − if (cinfo->ds->nbuckets >= size) { | |
| 783 | − /* This assumes there is only one IOMODE_RW lseg. What | |
| 784 | − * we really want to do is have a layout_hdr level | |
| 785 | − * dictionary of <multipath_list4, fh> keys, each | |
| 786 | − * associated with a struct list_head, populated by calls | |
| 787 | − * to filelayout_write_pagelist(). | |
| 788 | − * */ | |
| 789 | − return 0; | |
| 790 | − } | |
| 791 | − | |
| 792 | − buckets = kcalloc(size, sizeof(struct pnfs_commit_bucket), | |
| 793 | − gfp_flags); | |
| 794 | − if (!buckets) | |
| 795 | − return -ENOMEM; | |
| 796 | − for (i = 0; i < size; i++) { | |
| 797 | − INIT_LIST_HEAD(&buckets[i].written); | |
| 798 | − INIT_LIST_HEAD(&buckets[i].committing); | |
| 799 | − /* mark direct verifier as unset */ | |
| 800 | − buckets[i].direct_verf.committed = NFS_INVALID_STABLE_HOW; | |
| 801 | − } | |
| 802 | − | |
| 803 | − spin_lock(&cinfo->inode->i_lock); | |
| 804 | − if (cinfo->ds->nbuckets >= size) | |
| 805 | − goto out; | |
| 806 | − for (i = 0; i < cinfo->ds->nbuckets; i++) { | |
| 807 | − list_splice(&cinfo->ds->buckets[i].written, | |
| 808 | − &buckets[i].written); | |
| 809 | − list_splice(&cinfo->ds->buckets[i].committing, | |
| 810 | − &buckets[i].committing); | |
| 811 | − buckets[i].direct_verf.committed = | |
| 812 | − cinfo->ds->buckets[i].direct_verf.committed; | |
| 813 | − buckets[i].wlseg = cinfo->ds->buckets[i].wlseg; | |
| 814 | − buckets[i].clseg = cinfo->ds->buckets[i].clseg; | |
| 815 | − } | |
| 816 | − swap(cinfo->ds->buckets, buckets); | |
| 817 | − cinfo->ds->nbuckets = size; | |
| 818 | −out: | |
| 819 | − spin_unlock(&cinfo->inode->i_lock); | |
| 820 | − kfree(buckets); | |
| 821 | − return 0; | |
| 822 | −} | |
| 823 | − | |
| 824 | 764 | static struct pnfs_layout_segment * |
| 825 | 765 | filelayout_alloc_lseg(struct pnfs_layout_hdr *layoutid, |
| 826 | 766 | struct nfs4_layoutget_res *lgr, |
| @@ -943,9 +883,6 @@ static void · 116 unmodified lines | ||
| 943 | 883 | filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio, |
| 944 | 884 | struct nfs_page *req) |
| 945 | 885 | { |
| 946 | − struct nfs_commit_info cinfo; | |
| 947 | − int status; | |
| 948 | − | |
| 949 | 886 | pnfs_generic_pg_check_layout(pgio); |
| 950 | 887 | if (!pgio->pg_lseg) { |
| 951 | 888 | pgio->pg_lseg = fl_pnfs_update_layout(pgio->pg_inode, |
| @@ -964,17 +901,7 @@ filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio, · 12 unmodified lines | ||
| 964 | 901 | |
| 965 | 902 | /* If no lseg, fall back to write through mds */ |
| 966 | 903 | if (pgio->pg_lseg == NULL) |
| 967 | − goto out_mds; | |
| 968 | − nfs_init_cinfo(&cinfo, pgio->pg_inode, pgio->pg_dreq); | |
| 969 | − status = filelayout_alloc_commit_info(pgio->pg_lseg, &cinfo, GFP_NOFS); | |
| 970 | − if (status < 0) { | |
| 971 | − pnfs_put_lseg(pgio->pg_lseg); | |
| 972 | − pgio->pg_lseg = NULL; | |
| 973 | − goto out_mds; | |
| 974 | − } | |
| 975 | − return; | |
| 976 | −out_mds: | |
| 977 | − nfs_pageio_reset_write_mds(pgio); | |
| 904 | + nfs_pageio_reset_write_mds(pgio); | |
| 978 | 905 | } |
| 979 | 906 | |
| 980 | 907 | static const struct nfs_pageio_ops filelayout_pg_read_ops = { |
| @@ -550,17 +550,6 @@ out_err_free: · 549 unmodified lines | ||
| 550 | 550 | goto out_free_page; |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | −static bool ff_layout_has_rw_segments(struct pnfs_layout_hdr *layout) | |
| 554 | −{ | |
| 555 | − struct pnfs_layout_segment *lseg; | |
| 556 | − | |
| 557 | − list_for_each_entry(lseg, &layout->plh_segs, pls_list) | |
| 558 | − if (lseg->pls_range.iomode == IOMODE_RW) | |
| 559 | − return true; | |
| 560 | − | |
| 561 | − return false; | |
| 562 | −} | |
| 563 | − | |
| 564 | 553 | static void |
| 565 | 554 | ff_layout_free_lseg(struct pnfs_layout_segment *lseg) |
| 566 | 555 | { |
| @@ -575,24 +564,12 @@ ff_layout_free_lseg(struct pnfs_layout_segment *lseg) · 8 unmodified lines | ||
| 575 | 564 | ffl = FF_LAYOUT_FROM_HDR(lseg->pls_layout); |
| 576 | 565 | inode = ffl->generic_hdr.plh_inode; |
| 577 | 566 | spin_lock(&inode->i_lock); |
| 578 | − if (!ff_layout_has_rw_segments(lseg->pls_layout)) { | |
| 579 | − ffl->commit_info.nbuckets = 0; | |
| 580 | − kfree(ffl->commit_info.buckets); | |
| 581 | − ffl->commit_info.buckets = NULL; | |
| 582 | − } | |
| 583 | 567 | pnfs_generic_ds_cinfo_release_lseg(&ffl->commit_info, lseg); |
| 584 | 568 | spin_unlock(&inode->i_lock); |
| 585 | 569 | } |
| 586 | 570 | _ff_layout_free_lseg(fls); |
| 587 | 571 | } |
| 588 | 572 | |
| 589 | −/* Return 1 until we have multiple lsegs support */ | |
| 590 | −static int | |
| 591 | −ff_layout_get_lseg_count(struct nfs4_ff_layout_segment *fls) | |
| 592 | −{ | |
| 593 | − return 1; | |
| 594 | −} | |
| 595 | − | |
| 596 | 573 | static void |
| 597 | 574 | nfs4_ff_start_busy_timer(struct nfs4_ff_busy_timer *timer, ktime_t now) |
| 598 | 575 | { |
| @@ -737,52 +714,6 @@ nfs4_ff_layout_stat_io_end_write(struct rpc_task *task, · 138 unmodified lines | ||
| 737 | 714 | spin_unlock(&mirror->lock); |
| 738 | 715 | } |
| 739 | 716 | |
| 740 | −static int | |
| 741 | −ff_layout_alloc_commit_info(struct pnfs_layout_segment *lseg, | |
| 742 | − struct nfs_commit_info *cinfo, | |
| 743 | − gfp_t gfp_flags) | |
| 744 | −{ | |
| 745 | − struct nfs4_ff_layout_segment *fls = FF_LAYOUT_LSEG(lseg); | |
| 746 | − struct pnfs_commit_bucket *buckets; | |
| 747 | − int size; | |
| 748 | − | |
| 749 | − if (cinfo->ds->nbuckets != 0) { | |
| 750 | − /* This assumes there is only one RW lseg per file. | |
| 751 | − * To support multiple lseg per file, we need to | |
| 752 | − * change struct pnfs_commit_bucket to allow dynamic | |
| 753 | − * increasing nbuckets. | |
| 754 | − */ | |
| 755 | − return 0; | |
| 756 | − } | |
| 757 | − | |
| 758 | − size = ff_layout_get_lseg_count(fls) * FF_LAYOUT_MIRROR_COUNT(lseg); | |
| 759 | − | |
| 760 | − buckets = kcalloc(size, sizeof(struct pnfs_commit_bucket), | |
| 761 | − gfp_flags); | |
| 762 | − if (!buckets) | |
| 763 | − return -ENOMEM; | |
| 764 | − else { | |
| 765 | − int i; | |
| 766 | − | |
| 767 | − spin_lock(&cinfo->inode->i_lock); | |
| 768 | − if (cinfo->ds->nbuckets != 0) | |
| 769 | − kfree(buckets); | |
| 770 | − else { | |
| 771 | − cinfo->ds->buckets = buckets; | |
| 772 | − cinfo->ds->nbuckets = size; | |
| 773 | − for (i = 0; i < size; i++) { | |
| 774 | − INIT_LIST_HEAD(&buckets[i].written); | |
| 775 | − INIT_LIST_HEAD(&buckets[i].committing); | |
| 776 | − /* mark direct verifier as unset */ | |
| 777 | − buckets[i].direct_verf.committed = | |
| 778 | − NFS_INVALID_STABLE_HOW; | |
| 779 | − } | |
| 780 | − } | |
| 781 | − spin_unlock(&cinfo->inode->i_lock); | |
| 782 | − return 0; | |
| 783 | − } | |
| 784 | −} | |
| 785 | − | |
| 786 | 717 | static void |
| 787 | 718 | ff_layout_mark_ds_unreachable(struct pnfs_layout_segment *lseg, int idx) |
| 788 | 719 | { |
| @@ -944,10 +875,8 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio, · 155 unmodified lines | ||
| 944 | 875 | { |
| 945 | 876 | struct nfs4_ff_layout_mirror *mirror; |
| 946 | 877 | struct nfs_pgio_mirror *pgm; |
| 947 | − struct nfs_commit_info cinfo; | |
| 948 | 878 | struct nfs4_pnfs_ds *ds; |
| 949 | 879 | int i; |
| 950 | − int status; | |
| 951 | 880 | |
| 952 | 881 | retry: |
| 953 | 882 | pnfs_generic_pg_check_layout(pgio); |
| @@ -969,11 +898,6 @@ retry: · 15 unmodified lines | ||
| 969 | 898 | if (pgio->pg_lseg == NULL) |
| 970 | 899 | goto out_mds; |
| 971 | 900 | |
| 972 | − nfs_init_cinfo(&cinfo, pgio->pg_inode, pgio->pg_dreq); | |
| 973 | − status = ff_layout_alloc_commit_info(pgio->pg_lseg, &cinfo, GFP_NOFS); | |
| 974 | − if (status < 0) | |
| 975 | − goto out_mds; | |
| 976 | − | |
| 977 | 901 | /* Use a direct mapping of ds_idx to pgio mirror_idx */ |
| 978 | 902 | if (WARN_ON_ONCE(pgio->pg_mirror_count != |
| 979 | 903 | FF_LAYOUT_MIRROR_COUNT(pgio->pg_lseg))) |
| @@ -531,9 +531,6 @@ void nfs_clear_pnfs_ds_commit_verifiers(struct pnfs_ds_commit_info *cinfo) · 530 unmodified lines | ||
| 531 | 531 | { |
| 532 | 532 | struct pnfs_commit_array *array; |
| 533 | 533 | |
| 534 | − pnfs_bucket_clear_pnfs_ds_commit_verifiers(cinfo->buckets, | |
| 535 | − cinfo->nbuckets); | |
| 536 | − | |
| 537 | 534 | rcu_read_lock(); |
| 538 | 535 | list_for_each_entry_rcu(array, &cinfo->commits, cinfo_list) |
| 539 | 536 | pnfs_bucket_clear_pnfs_ds_commit_verifiers(array->buckets, |
| @@ -292,12 +292,6 @@ int pnfs_generic_scan_commit_lists(struct nfs_commit_info *cinfo, int max) · 291 unmodified lines | ||
| 292 | 292 | struct pnfs_commit_array *array; |
| 293 | 293 | int rv = 0, cnt; |
| 294 | 294 | |
| 295 | − cnt = pnfs_bucket_scan_array(cinfo, fl_cinfo->buckets, | |
| 296 | − fl_cinfo->nbuckets, max); | |
| 297 | − rv += cnt; | |
| 298 | − max -= cnt; | |
| 299 | − if (!max) | |
| 300 | − return rv; | |
| 301 | 295 | rcu_read_lock(); |
| 302 | 296 | list_for_each_entry_rcu(array, &fl_cinfo->commits, cinfo_list) { |
| 303 | 297 | if (!array->lseg || !pnfs_get_commit_array(array)) |
| @@ -353,11 +347,6 @@ void pnfs_generic_recover_commit_reqs(struct list_head *dst, · 49 unmodified lines | ||
| 353 | 347 | unsigned int nwritten; |
| 354 | 348 | |
| 355 | 349 | lockdep_assert_held(&NFS_I(cinfo->inode)->commit_mutex); |
| 356 | − nwritten = pnfs_bucket_recover_commit_reqs(dst, | |
| 357 | − fl_cinfo->buckets, | |
| 358 | − fl_cinfo->nbuckets, | |
| 359 | − cinfo); | |
| 360 | − fl_cinfo->nwritten -= nwritten; | |
| 361 | 350 | rcu_read_lock(); |
| 362 | 351 | list_for_each_entry_rcu(array, &fl_cinfo->commits, cinfo_list) { |
| 363 | 352 | if (!array->lseg || !pnfs_get_commit_array(array)) |
| @@ -412,10 +401,6 @@ pnfs_generic_search_commit_reqs(struct nfs_commit_info *cinfo, struct page *page · 48 unmodified lines | ||
| 412 | 401 | struct pnfs_commit_array *array; |
| 413 | 402 | struct nfs_page *req; |
| 414 | 403 | |
| 415 | − req = pnfs_bucket_search_commit_reqs(fl_cinfo->buckets, | |
| 416 | − fl_cinfo->nbuckets, page); | |
| 417 | − if (req) | |
| 418 | − return req; | |
| 419 | 404 | list_for_each_entry(array, &fl_cinfo->commits, cinfo_list) { |
| 420 | 405 | req = pnfs_bucket_search_commit_reqs(array->buckets, |
| 421 | 406 | array->nbuckets, page); |
| @@ -550,9 +535,6 @@ pnfs_generic_commit_pagelist(struct inode *inode, struct list_head *mds_pages, · 128 unmodified lines | ||
| 550 | 535 | nreq++; |
| 551 | 536 | } |
| 552 | 537 | |
| 553 | − nreq += pnfs_bucket_alloc_ds_commits(&list, fl_cinfo->buckets, | |
| 554 | − fl_cinfo->nbuckets, cinfo); | |
| 555 | − | |
| 556 | 538 | nreq += pnfs_alloc_ds_commits_list(&list, fl_cinfo, cinfo); |
| 557 | 539 | if (nreq == 0) |
| 558 | 540 | goto out; |
| @@ -1284,8 +1284,6 @@ struct pnfs_ds_commit_info { · 1283 unmodified lines | ||
| 1284 | 1284 | struct list_head commits; |
| 1285 | 1285 | unsigned int nwritten; |
| 1286 | 1286 | unsigned int ncommitting; |
| 1287 | − unsigned int nbuckets; | |
| 1288 | − struct pnfs_commit_bucket *buckets; | |
| 1289 | 1287 | }; |
| 1290 | 1288 | |
| 1291 | 1289 | struct nfs41_state_protection { |
| @@ -1396,22 +1394,11 @@ struct nfs41_free_stateid_res { · 104 unmodified lines | ||
| 1396 | 1394 | unsigned int status; |
| 1397 | 1395 | }; |
| 1398 | 1396 | |
| 1399 | −static inline void | |
| 1400 | −nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo) | |
| 1401 | −{ | |
| 1402 | − kfree(cinfo->buckets); | |
| 1403 | −} | |
| 1404 | − | |
| 1405 | 1397 | #else |
| 1406 | 1398 | |
| 1407 | 1399 | struct pnfs_ds_commit_info { |
| 1408 | 1400 | }; |
| 1409 | 1401 | |
| 1410 | −static inline void | |
| 1411 | −nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo) | |
| 1412 | −{ | |
| 1413 | −} | |
| 1414 | − | |
| 1415 | 1402 | #endif /* CONFIG_NFS_V4_1 */ |
| 1416 | 1403 | |
| 1417 | 1404 | #ifdef CONFIG_NFS_V4_2 |