]> git.baikalelectronics.ru Git - kernel.git/commitdiff
NFS: Remove bucket array from struct pnfs_ds_commit_info
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Sat, 21 Mar 2020 13:50:05 +0000 (09:50 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 27 Mar 2020 20:34:35 +0000 (16:34 -0400)
Remove the unused bucket array in struct pnfs_ds_commit_info.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/direct.c
fs/nfs/filelayout/filelayout.c
fs/nfs/flexfilelayout/flexfilelayout.c
fs/nfs/internal.h
fs/nfs/pnfs_nfs.c
include/linux/nfs_xdr.h

index 4ee26465b51071c1624bba15f08f1246ad337ef7..61f93a0fb0e09375e4c1315817f4905902ae5863 100644 (file)
@@ -217,7 +217,6 @@ static void nfs_direct_req_free(struct kref *kref)
        struct nfs_direct_req *dreq = container_of(kref, struct nfs_direct_req, kref);
 
        pnfs_release_ds_info(&dreq->ds_cinfo, dreq->inode);
-       nfs_free_pnfs_ds_cinfo(&dreq->ds_cinfo);
        if (dreq->l_ctx != NULL)
                nfs_put_lock_context(dreq->l_ctx);
        if (dreq->ctx != NULL)
index 795508054a4de49bfb05c28f9ad2f75f76c8d411..854f350e259975e0a4da63c685951fe50172df85 100644 (file)
@@ -755,72 +755,12 @@ filelayout_free_lseg(struct pnfs_layout_segment *lseg)
                flo = FILELAYOUT_FROM_HDR(lseg->pls_layout);
                inode = flo->generic_hdr.plh_inode;
                spin_lock(&inode->i_lock);
-               flo->commit_info.nbuckets = 0;
-               kfree(flo->commit_info.buckets);
-               flo->commit_info.buckets = NULL;
                pnfs_generic_ds_cinfo_release_lseg(&flo->commit_info, lseg);
                spin_unlock(&inode->i_lock);
        }
        _filelayout_free_lseg(fl);
 }
 
-static int
-filelayout_alloc_commit_info(struct pnfs_layout_segment *lseg,
-                            struct nfs_commit_info *cinfo,
-                            gfp_t gfp_flags)
-{
-       struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg);
-       struct pnfs_commit_bucket *buckets;
-       int size, i;
-
-       if (fl->commit_through_mds)
-               return 0;
-
-       size = (fl->stripe_type == STRIPE_SPARSE) ?
-               fl->dsaddr->ds_num : fl->dsaddr->stripe_count;
-
-       if (cinfo->ds->nbuckets >= size) {
-               /* This assumes there is only one IOMODE_RW lseg.  What
-                * we really want to do is have a layout_hdr level
-                * dictionary of <multipath_list4, fh> keys, each
-                * associated with a struct list_head, populated by calls
-                * to filelayout_write_pagelist().
-                * */
-               return 0;
-       }
-
-       buckets = kcalloc(size, sizeof(struct pnfs_commit_bucket),
-                         gfp_flags);
-       if (!buckets)
-               return -ENOMEM;
-       for (i = 0; i < size; i++) {
-               INIT_LIST_HEAD(&buckets[i].written);
-               INIT_LIST_HEAD(&buckets[i].committing);
-               /* mark direct verifier as unset */
-               buckets[i].direct_verf.committed = NFS_INVALID_STABLE_HOW;
-       }
-
-       spin_lock(&cinfo->inode->i_lock);
-       if (cinfo->ds->nbuckets >= size)
-               goto out;
-       for (i = 0; i < cinfo->ds->nbuckets; i++) {
-               list_splice(&cinfo->ds->buckets[i].written,
-                           &buckets[i].written);
-               list_splice(&cinfo->ds->buckets[i].committing,
-                           &buckets[i].committing);
-               buckets[i].direct_verf.committed =
-                       cinfo->ds->buckets[i].direct_verf.committed;
-               buckets[i].wlseg = cinfo->ds->buckets[i].wlseg;
-               buckets[i].clseg = cinfo->ds->buckets[i].clseg;
-       }
-       swap(cinfo->ds->buckets, buckets);
-       cinfo->ds->nbuckets = size;
-out:
-       spin_unlock(&cinfo->inode->i_lock);
-       kfree(buckets);
-       return 0;
-}
-
 static struct pnfs_layout_segment *
 filelayout_alloc_lseg(struct pnfs_layout_hdr *layoutid,
                      struct nfs4_layoutget_res *lgr,
@@ -943,9 +883,6 @@ static void
 filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio,
                         struct nfs_page *req)
 {
-       struct nfs_commit_info cinfo;
-       int status;
-
        pnfs_generic_pg_check_layout(pgio);
        if (!pgio->pg_lseg) {
                pgio->pg_lseg = fl_pnfs_update_layout(pgio->pg_inode,
@@ -964,17 +901,7 @@ filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio,
 
        /* If no lseg, fall back to write through mds */
        if (pgio->pg_lseg == NULL)
-               goto out_mds;
-       nfs_init_cinfo(&cinfo, pgio->pg_inode, pgio->pg_dreq);
-       status = filelayout_alloc_commit_info(pgio->pg_lseg, &cinfo, GFP_NOFS);
-       if (status < 0) {
-               pnfs_put_lseg(pgio->pg_lseg);
-               pgio->pg_lseg = NULL;
-               goto out_mds;
-       }
-       return;
-out_mds:
-       nfs_pageio_reset_write_mds(pgio);
+               nfs_pageio_reset_write_mds(pgio);
 }
 
 static const struct nfs_pageio_ops filelayout_pg_read_ops = {
index f343a241906acb07c3331ebc4580e737af5c8569..1a4e36d07eab833e9f563b224c163bbe89bca803 100644 (file)
@@ -550,17 +550,6 @@ out_err_free:
        goto out_free_page;
 }
 
-static bool ff_layout_has_rw_segments(struct pnfs_layout_hdr *layout)
-{
-       struct pnfs_layout_segment *lseg;
-
-       list_for_each_entry(lseg, &layout->plh_segs, pls_list)
-               if (lseg->pls_range.iomode == IOMODE_RW)
-                       return true;
-
-       return false;
-}
-
 static void
 ff_layout_free_lseg(struct pnfs_layout_segment *lseg)
 {
@@ -575,24 +564,12 @@ ff_layout_free_lseg(struct pnfs_layout_segment *lseg)
                ffl = FF_LAYOUT_FROM_HDR(lseg->pls_layout);
                inode = ffl->generic_hdr.plh_inode;
                spin_lock(&inode->i_lock);
-               if (!ff_layout_has_rw_segments(lseg->pls_layout)) {
-                       ffl->commit_info.nbuckets = 0;
-                       kfree(ffl->commit_info.buckets);
-                       ffl->commit_info.buckets = NULL;
-               }
                pnfs_generic_ds_cinfo_release_lseg(&ffl->commit_info, lseg);
                spin_unlock(&inode->i_lock);
        }
        _ff_layout_free_lseg(fls);
 }
 
-/* Return 1 until we have multiple lsegs support */
-static int
-ff_layout_get_lseg_count(struct nfs4_ff_layout_segment *fls)
-{
-       return 1;
-}
-
 static void
 nfs4_ff_start_busy_timer(struct nfs4_ff_busy_timer *timer, ktime_t now)
 {
@@ -737,52 +714,6 @@ nfs4_ff_layout_stat_io_end_write(struct rpc_task *task,
        spin_unlock(&mirror->lock);
 }
 
-static int
-ff_layout_alloc_commit_info(struct pnfs_layout_segment *lseg,
-                           struct nfs_commit_info *cinfo,
-                           gfp_t gfp_flags)
-{
-       struct nfs4_ff_layout_segment *fls = FF_LAYOUT_LSEG(lseg);
-       struct pnfs_commit_bucket *buckets;
-       int size;
-
-       if (cinfo->ds->nbuckets != 0) {
-               /* This assumes there is only one RW lseg per file.
-                * To support multiple lseg per file, we need to
-                * change struct pnfs_commit_bucket to allow dynamic
-                * increasing nbuckets.
-                */
-               return 0;
-       }
-
-       size = ff_layout_get_lseg_count(fls) * FF_LAYOUT_MIRROR_COUNT(lseg);
-
-       buckets = kcalloc(size, sizeof(struct pnfs_commit_bucket),
-                         gfp_flags);
-       if (!buckets)
-               return -ENOMEM;
-       else {
-               int i;
-
-               spin_lock(&cinfo->inode->i_lock);
-               if (cinfo->ds->nbuckets != 0)
-                       kfree(buckets);
-               else {
-                       cinfo->ds->buckets = buckets;
-                       cinfo->ds->nbuckets = size;
-                       for (i = 0; i < size; i++) {
-                               INIT_LIST_HEAD(&buckets[i].written);
-                               INIT_LIST_HEAD(&buckets[i].committing);
-                               /* mark direct verifier as unset */
-                               buckets[i].direct_verf.committed =
-                                       NFS_INVALID_STABLE_HOW;
-                       }
-               }
-               spin_unlock(&cinfo->inode->i_lock);
-               return 0;
-       }
-}
-
 static void
 ff_layout_mark_ds_unreachable(struct pnfs_layout_segment *lseg, int idx)
 {
@@ -944,10 +875,8 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
 {
        struct nfs4_ff_layout_mirror *mirror;
        struct nfs_pgio_mirror *pgm;
-       struct nfs_commit_info cinfo;
        struct nfs4_pnfs_ds *ds;
        int i;
-       int status;
 
 retry:
        pnfs_generic_pg_check_layout(pgio);
@@ -969,11 +898,6 @@ retry:
        if (pgio->pg_lseg == NULL)
                goto out_mds;
 
-       nfs_init_cinfo(&cinfo, pgio->pg_inode, pgio->pg_dreq);
-       status = ff_layout_alloc_commit_info(pgio->pg_lseg, &cinfo, GFP_NOFS);
-       if (status < 0)
-               goto out_mds;
-
        /* Use a direct mapping of ds_idx to pgio mirror_idx */
        if (WARN_ON_ONCE(pgio->pg_mirror_count !=
            FF_LAYOUT_MIRROR_COUNT(pgio->pg_lseg)))
index 683146a515990d5de950dce0e7ff83cad2a1cf8a..78f317fac940232294ae4882995613055d0899ac 100644 (file)
@@ -531,9 +531,6 @@ void nfs_clear_pnfs_ds_commit_verifiers(struct pnfs_ds_commit_info *cinfo)
 {
        struct pnfs_commit_array *array;
 
-       pnfs_bucket_clear_pnfs_ds_commit_verifiers(cinfo->buckets,
-                       cinfo->nbuckets);
-
        rcu_read_lock();
        list_for_each_entry_rcu(array, &cinfo->commits, cinfo_list)
                pnfs_bucket_clear_pnfs_ds_commit_verifiers(array->buckets,
index 9b55919e64ac44136110f8b451f75fadebf00af9..20f12f3cbe383d1df41f9bcbf09eb3157f76eeef 100644 (file)
@@ -292,12 +292,6 @@ int pnfs_generic_scan_commit_lists(struct nfs_commit_info *cinfo, int max)
        struct pnfs_commit_array *array;
        int rv = 0, cnt;
 
-       cnt = pnfs_bucket_scan_array(cinfo, fl_cinfo->buckets,
-                       fl_cinfo->nbuckets, max);
-       rv += cnt;
-       max -= cnt;
-       if (!max)
-               return rv;
        rcu_read_lock();
        list_for_each_entry_rcu(array, &fl_cinfo->commits, cinfo_list) {
                if (!array->lseg || !pnfs_get_commit_array(array))
@@ -353,11 +347,6 @@ void pnfs_generic_recover_commit_reqs(struct list_head *dst,
        unsigned int nwritten;
 
        lockdep_assert_held(&NFS_I(cinfo->inode)->commit_mutex);
-       nwritten = pnfs_bucket_recover_commit_reqs(dst,
-                                                  fl_cinfo->buckets,
-                                                  fl_cinfo->nbuckets,
-                                                  cinfo);
-       fl_cinfo->nwritten -= nwritten;
        rcu_read_lock();
        list_for_each_entry_rcu(array, &fl_cinfo->commits, cinfo_list) {
                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
        struct pnfs_commit_array *array;
        struct nfs_page *req;
 
-       req = pnfs_bucket_search_commit_reqs(fl_cinfo->buckets,
-                       fl_cinfo->nbuckets, page);
-       if (req)
-               return req;
        list_for_each_entry(array, &fl_cinfo->commits, cinfo_list) {
                req = pnfs_bucket_search_commit_reqs(array->buckets,
                                array->nbuckets, page);
@@ -550,9 +535,6 @@ pnfs_generic_commit_pagelist(struct inode *inode, struct list_head *mds_pages,
                nreq++;
        }
 
-       nreq += pnfs_bucket_alloc_ds_commits(&list, fl_cinfo->buckets,
-                       fl_cinfo->nbuckets, cinfo);
-
        nreq += pnfs_alloc_ds_commits_list(&list, fl_cinfo, cinfo);
        if (nreq == 0)
                goto out;
index 33be2ee2a2480269654e8a1671348b8b83efdcc9..2903597ec88cb1f898855343442c05f55adceeb6 100644 (file)
@@ -1284,8 +1284,6 @@ struct pnfs_ds_commit_info {
        struct list_head commits;
        unsigned int nwritten;
        unsigned int ncommitting;
-       unsigned int nbuckets;
-       struct pnfs_commit_bucket *buckets;
 };
 
 struct nfs41_state_protection {
@@ -1396,22 +1394,11 @@ struct nfs41_free_stateid_res {
        unsigned int                    status;
 };
 
-static inline void
-nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
-{
-       kfree(cinfo->buckets);
-}
-
 #else
 
 struct pnfs_ds_commit_info {
 };
 
-static inline void
-nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
-{
-}
-
 #endif /* CONFIG_NFS_V4_1 */
 
 #ifdef CONFIG_NFS_V4_2