History

NFS: Remove bucket array from struct pnfs_ds_commit_info

Remove the unused bucket array in struct pnfs_ds_commit_info.

Trond Myklebust committed 6 years ago

Commit 0aa647b1 parent fb6b53b6 files · +1 −185Browse files

Unified · Split

6 files
  1. fs/nfs/direct.c +0 −1
  2. fs/nfs/filelayout/filelayout.c +1 −74
  3. fs/nfs/flexfilelayout/flexfilelayout.c +0 −76
  4. fs/nfs/internal.h +0 −3
  5. fs/nfs/pnfs_nfs.c +0 −18
  6. include/linux/nfs_xdr.h +0 −13
fs/nfs/direct.c+0−1
@@ -217,7 +217,6 @@ static void nfs_direct_req_free(struct kref *kref) · 216 unmodified lines
217217 struct nfs_direct_req *dreq = container_of(kref, struct nfs_direct_req, kref);
218218
219219 pnfs_release_ds_info(&dreq->ds_cinfo, dreq->inode);
220− nfs_free_pnfs_ds_cinfo(&dreq->ds_cinfo);
221220 if (dreq->l_ctx != NULL)
222221 nfs_put_lock_context(dreq->l_ctx);
223222 if (dreq->ctx != NULL)
fs/nfs/filelayout/filelayout.c+1−74
@@ -755,72 +755,12 @@ filelayout_free_lseg(struct pnfs_layout_segment *lseg) · 754 unmodified lines
755755 flo = FILELAYOUT_FROM_HDR(lseg->pls_layout);
756756 inode = flo->generic_hdr.plh_inode;
757757 spin_lock(&inode->i_lock);
758− flo->commit_info.nbuckets = 0;
759− kfree(flo->commit_info.buckets);
760− flo->commit_info.buckets = NULL;
761758 pnfs_generic_ds_cinfo_release_lseg(&flo->commit_info, lseg);
762759 spin_unlock(&inode->i_lock);
763760 }
764761 _filelayout_free_lseg(fl);
765762 }
766763
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−
824764 static struct pnfs_layout_segment *
825765 filelayout_alloc_lseg(struct pnfs_layout_hdr *layoutid,
826766 struct nfs4_layoutget_res *lgr,
@@ -943,9 +883,6 @@ static void · 116 unmodified lines
943883 filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio,
944884 struct nfs_page *req)
945885 {
946− struct nfs_commit_info cinfo;
947− int status;
948−
949886 pnfs_generic_pg_check_layout(pgio);
950887 if (!pgio->pg_lseg) {
951888 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
964901
965902 /* If no lseg, fall back to write through mds */
966903 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);
978905 }
979906
980907 static const struct nfs_pageio_ops filelayout_pg_read_ops = {
fs/nfs/flexfilelayout/flexfilelayout.c+0−76
@@ -550,17 +550,6 @@ out_err_free: · 549 unmodified lines
550550 goto out_free_page;
551551 }
552552
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−
564553 static void
565554 ff_layout_free_lseg(struct pnfs_layout_segment *lseg)
566555 {
@@ -575,24 +564,12 @@ ff_layout_free_lseg(struct pnfs_layout_segment *lseg) · 8 unmodified lines
575564 ffl = FF_LAYOUT_FROM_HDR(lseg->pls_layout);
576565 inode = ffl->generic_hdr.plh_inode;
577566 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− }
583567 pnfs_generic_ds_cinfo_release_lseg(&ffl->commit_info, lseg);
584568 spin_unlock(&inode->i_lock);
585569 }
586570 _ff_layout_free_lseg(fls);
587571 }
588572
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−
596573 static void
597574 nfs4_ff_start_busy_timer(struct nfs4_ff_busy_timer *timer, ktime_t now)
598575 {
@@ -737,52 +714,6 @@ nfs4_ff_layout_stat_io_end_write(struct rpc_task *task, · 138 unmodified lines
737714 spin_unlock(&mirror->lock);
738715 }
739716
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−
786717 static void
787718 ff_layout_mark_ds_unreachable(struct pnfs_layout_segment *lseg, int idx)
788719 {
@@ -944,10 +875,8 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio, · 155 unmodified lines
944875 {
945876 struct nfs4_ff_layout_mirror *mirror;
946877 struct nfs_pgio_mirror *pgm;
947− struct nfs_commit_info cinfo;
948878 struct nfs4_pnfs_ds *ds;
949879 int i;
950− int status;
951880
952881 retry:
953882 pnfs_generic_pg_check_layout(pgio);
@@ -969,11 +898,6 @@ retry: · 15 unmodified lines
969898 if (pgio->pg_lseg == NULL)
970899 goto out_mds;
971900
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−
977901 /* Use a direct mapping of ds_idx to pgio mirror_idx */
978902 if (WARN_ON_ONCE(pgio->pg_mirror_count !=
979903 FF_LAYOUT_MIRROR_COUNT(pgio->pg_lseg)))
fs/nfs/internal.h+0−3
@@ -531,9 +531,6 @@ void nfs_clear_pnfs_ds_commit_verifiers(struct pnfs_ds_commit_info *cinfo) · 530 unmodified lines
531531 {
532532 struct pnfs_commit_array *array;
533533
534− pnfs_bucket_clear_pnfs_ds_commit_verifiers(cinfo->buckets,
535− cinfo->nbuckets);
536−
537534 rcu_read_lock();
538535 list_for_each_entry_rcu(array, &cinfo->commits, cinfo_list)
539536 pnfs_bucket_clear_pnfs_ds_commit_verifiers(array->buckets,
fs/nfs/pnfs_nfs.c+0−18
@@ -292,12 +292,6 @@ int pnfs_generic_scan_commit_lists(struct nfs_commit_info *cinfo, int max) · 291 unmodified lines
292292 struct pnfs_commit_array *array;
293293 int rv = 0, cnt;
294294
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;
301295 rcu_read_lock();
302296 list_for_each_entry_rcu(array, &fl_cinfo->commits, cinfo_list) {
303297 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
353347 unsigned int nwritten;
354348
355349 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;
361350 rcu_read_lock();
362351 list_for_each_entry_rcu(array, &fl_cinfo->commits, cinfo_list) {
363352 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
412401 struct pnfs_commit_array *array;
413402 struct nfs_page *req;
414403
415− req = pnfs_bucket_search_commit_reqs(fl_cinfo->buckets,
416− fl_cinfo->nbuckets, page);
417− if (req)
418− return req;
419404 list_for_each_entry(array, &fl_cinfo->commits, cinfo_list) {
420405 req = pnfs_bucket_search_commit_reqs(array->buckets,
421406 array->nbuckets, page);
@@ -550,9 +535,6 @@ pnfs_generic_commit_pagelist(struct inode *inode, struct list_head *mds_pages, · 128 unmodified lines
550535 nreq++;
551536 }
552537
553− nreq += pnfs_bucket_alloc_ds_commits(&list, fl_cinfo->buckets,
554− fl_cinfo->nbuckets, cinfo);
555−
556538 nreq += pnfs_alloc_ds_commits_list(&list, fl_cinfo, cinfo);
557539 if (nreq == 0)
558540 goto out;
include/linux/nfs_xdr.h+0−13
@@ -1284,8 +1284,6 @@ struct pnfs_ds_commit_info { · 1283 unmodified lines
12841284 struct list_head commits;
12851285 unsigned int nwritten;
12861286 unsigned int ncommitting;
1287− unsigned int nbuckets;
1288− struct pnfs_commit_bucket *buckets;
12891287 };
12901288
12911289 struct nfs41_state_protection {
@@ -1396,22 +1394,11 @@ struct nfs41_free_stateid_res { · 104 unmodified lines
13961394 unsigned int status;
13971395 };
13981396
1399−static inline void
1400−nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
1401−{
1402− kfree(cinfo->buckets);
1403−}
1404−
14051397 #else
14061398
14071399 struct pnfs_ds_commit_info {
14081400 };
14091401
1410−static inline void
1411−nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
1412−{
1413−}
1414−
14151402 #endif /* CONFIG_NFS_V4_1 */
14161403
14171404 #ifdef CONFIG_NFS_V4_2