aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorFred Isaman <iisaman@netapp.com>2011-03-23 09:27:50 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-03-23 15:29:03 -0400
commit425eb736cd905181a4dd4dc8d66342a7c7ab2f27 (patch)
tree0e6b9288f91532b940e3a62cf50e5397f5e5dafc /fs
parentc879513e91c9e38957f0d9647d22469f1887e4da (diff)
NFSv4.1: alloc and free commit_buckets
Create a preallocated list header to hold nfs_pages for each non-MDS COMMIT destination. Note this is not necessarily each DS, but is basically each <DS, fh> pair. Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4filelayout.c22
-rw-r--r--fs/nfs/nfs4filelayout.h2
2 files changed, 24 insertions, 0 deletions
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 9401afd5650e..03ff80c67c6e 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -503,6 +503,7 @@ filelayout_free_lseg(struct pnfs_layout_segment *lseg)
503 503
504 dprintk("--> %s\n", __func__); 504 dprintk("--> %s\n", __func__);
505 nfs4_fl_put_deviceid(fl->dsaddr); 505 nfs4_fl_put_deviceid(fl->dsaddr);
506 kfree(fl->commit_buckets);
506 _filelayout_free_lseg(fl); 507 _filelayout_free_lseg(fl);
507} 508}
508 509
@@ -524,6 +525,27 @@ filelayout_alloc_lseg(struct pnfs_layout_hdr *layoutid,
524 _filelayout_free_lseg(fl); 525 _filelayout_free_lseg(fl);
525 return NULL; 526 return NULL;
526 } 527 }
528
529 /* This assumes there is only one IOMODE_RW lseg. What
530 * we really want to do is have a layout_hdr level
531 * dictionary of <multipath_list4, fh> keys, each
532 * associated with a struct list_head, populated by calls
533 * to filelayout_write_pagelist().
534 * */
535 if ((!fl->commit_through_mds) && (lgr->range.iomode == IOMODE_RW)) {
536 int i;
537 int size = (fl->stripe_type == STRIPE_SPARSE) ?
538 fl->dsaddr->ds_num : fl->dsaddr->stripe_count;
539
540 fl->commit_buckets = kcalloc(size, sizeof(struct list_head), GFP_KERNEL);
541 if (!fl->commit_buckets) {
542 filelayout_free_lseg(&fl->generic_hdr);
543 return NULL;
544 }
545 fl->number_of_buckets = size;
546 for (i = 0; i < size; i++)
547 INIT_LIST_HEAD(&fl->commit_buckets[i]);
548 }
527 return &fl->generic_hdr; 549 return &fl->generic_hdr;
528} 550}
529 551
diff --git a/fs/nfs/nfs4filelayout.h b/fs/nfs/nfs4filelayout.h
index ee0c907742b5..085a354e0f08 100644
--- a/fs/nfs/nfs4filelayout.h
+++ b/fs/nfs/nfs4filelayout.h
@@ -79,6 +79,8 @@ struct nfs4_filelayout_segment {
79 struct nfs4_file_layout_dsaddr *dsaddr; /* Point to GETDEVINFO data */ 79 struct nfs4_file_layout_dsaddr *dsaddr; /* Point to GETDEVINFO data */
80 unsigned int num_fh; 80 unsigned int num_fh;
81 struct nfs_fh **fh_array; 81 struct nfs_fh **fh_array;
82 struct list_head *commit_buckets; /* Sort commits to ds */
83 int number_of_buckets;
82}; 84};
83 85
84static inline struct nfs4_filelayout_segment * 86static inline struct nfs4_filelayout_segment *