aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-09-20 16:33:30 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-09-28 16:03:13 -0400
commit57036a377600ec0900b13f29814aa19072ad3e52 (patch)
treed9509d3e0611e47247354056af549ffa3bcb4364 /fs/nfs
parentbb346f63976823c2959b0c5917928f12cbf96e4a (diff)
NFSv4.1: Rename the pnfs_put_lseg_common to pnfs_layout_remove_lseg
The latter name is more descriptive of the actual function. Also rename pnfs_insert_layout to pnfs_layout_insert_lseg. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/pnfs.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index ac94fb86fd1..33273b3a330 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -319,21 +319,22 @@ static void free_lseg(struct pnfs_layout_segment *lseg)
319 struct inode *ino = lseg->pls_layout->plh_inode; 319 struct inode *ino = lseg->pls_layout->plh_inode;
320 320
321 NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg); 321 NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg);
322 /* Matched by pnfs_get_layout_hdr in pnfs_insert_layout */ 322 /* Matched by pnfs_get_layout_hdr in pnfs_layout_insert_lseg */
323 pnfs_put_layout_hdr(NFS_I(ino)->layout); 323 pnfs_put_layout_hdr(NFS_I(ino)->layout);
324} 324}
325 325
326static void 326static void
327pnfs_put_lseg_common(struct pnfs_layout_segment *lseg) 327pnfs_layout_remove_lseg(struct pnfs_layout_hdr *lo,
328 struct pnfs_layout_segment *lseg)
328{ 329{
329 struct inode *inode = lseg->pls_layout->plh_inode; 330 struct inode *inode = lo->plh_inode;
330 331
331 WARN_ON(test_bit(NFS_LSEG_VALID, &lseg->pls_flags)); 332 WARN_ON(test_bit(NFS_LSEG_VALID, &lseg->pls_flags));
332 list_del_init(&lseg->pls_list); 333 list_del_init(&lseg->pls_list);
333 if (list_empty(&lseg->pls_layout->plh_segs)) { 334 if (list_empty(&lo->plh_segs)) {
334 set_bit(NFS_LAYOUT_DESTROYED, &lseg->pls_layout->plh_flags); 335 set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags);
335 /* Matched by initial refcount set in alloc_init_layout_hdr */ 336 /* Matched by initial refcount set in alloc_init_layout_hdr */
336 pnfs_put_layout_hdr_locked(lseg->pls_layout); 337 pnfs_put_layout_hdr_locked(lo);
337 } 338 }
338 rpc_wake_up(&NFS_SERVER(inode)->roc_rpcwaitq); 339 rpc_wake_up(&NFS_SERVER(inode)->roc_rpcwaitq);
339} 340}
@@ -341,6 +342,7 @@ pnfs_put_lseg_common(struct pnfs_layout_segment *lseg)
341void 342void
342pnfs_put_lseg(struct pnfs_layout_segment *lseg) 343pnfs_put_lseg(struct pnfs_layout_segment *lseg)
343{ 344{
345 struct pnfs_layout_hdr *lo;
344 struct inode *inode; 346 struct inode *inode;
345 347
346 if (!lseg) 348 if (!lseg)
@@ -349,13 +351,14 @@ pnfs_put_lseg(struct pnfs_layout_segment *lseg)
349 dprintk("%s: lseg %p ref %d valid %d\n", __func__, lseg, 351 dprintk("%s: lseg %p ref %d valid %d\n", __func__, lseg,
350 atomic_read(&lseg->pls_refcount), 352 atomic_read(&lseg->pls_refcount),
351 test_bit(NFS_LSEG_VALID, &lseg->pls_flags)); 353 test_bit(NFS_LSEG_VALID, &lseg->pls_flags));
352 inode = lseg->pls_layout->plh_inode; 354 lo = lseg->pls_layout;
355 inode = lo->plh_inode;
353 if (atomic_dec_and_lock(&lseg->pls_refcount, &inode->i_lock)) { 356 if (atomic_dec_and_lock(&lseg->pls_refcount, &inode->i_lock)) {
354 LIST_HEAD(free_me); 357 LIST_HEAD(free_me);
355 358
356 pnfs_put_lseg_common(lseg); 359 pnfs_layout_remove_lseg(lo, lseg);
357 list_add(&lseg->pls_list, &free_me);
358 spin_unlock(&inode->i_lock); 360 spin_unlock(&inode->i_lock);
361 list_add(&lseg->pls_list, &free_me);
359 pnfs_free_lseg_list(&free_me); 362 pnfs_free_lseg_list(&free_me);
360 } 363 }
361} 364}
@@ -443,7 +446,7 @@ static int mark_lseg_invalid(struct pnfs_layout_segment *lseg,
443 dprintk("%s: lseg %p ref %d\n", __func__, lseg, 446 dprintk("%s: lseg %p ref %d\n", __func__, lseg,
444 atomic_read(&lseg->pls_refcount)); 447 atomic_read(&lseg->pls_refcount));
445 if (atomic_dec_and_test(&lseg->pls_refcount)) { 448 if (atomic_dec_and_test(&lseg->pls_refcount)) {
446 pnfs_put_lseg_common(lseg); 449 pnfs_layout_remove_lseg(lseg->pls_layout, lseg);
447 list_add(&lseg->pls_list, tmp_list); 450 list_add(&lseg->pls_list, tmp_list);
448 rv = 1; 451 rv = 1;
449 } 452 }
@@ -861,7 +864,7 @@ cmp_layout(struct pnfs_layout_range *l1,
861} 864}
862 865
863static void 866static void
864pnfs_insert_layout(struct pnfs_layout_hdr *lo, 867pnfs_layout_insert_lseg(struct pnfs_layout_hdr *lo,
865 struct pnfs_layout_segment *lseg) 868 struct pnfs_layout_segment *lseg)
866{ 869{
867 struct pnfs_layout_segment *lp; 870 struct pnfs_layout_segment *lp;
@@ -1211,7 +1214,7 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
1211 init_lseg(lo, lseg); 1214 init_lseg(lo, lseg);
1212 lseg->pls_range = res->range; 1215 lseg->pls_range = res->range;
1213 pnfs_get_lseg(lseg); 1216 pnfs_get_lseg(lseg);
1214 pnfs_insert_layout(lo, lseg); 1217 pnfs_layout_insert_lseg(lo, lseg);
1215 1218
1216 if (res->return_on_close) { 1219 if (res->return_on_close) {
1217 set_bit(NFS_LSEG_ROC, &lseg->pls_flags); 1220 set_bit(NFS_LSEG_ROC, &lseg->pls_flags);