aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4filelayout.c
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/nfs/nfs4filelayout.c
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/nfs/nfs4filelayout.c')
-rw-r--r--fs/nfs/nfs4filelayout.c22
1 files changed, 22 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