• Home
  • Raw
  • Download

Lines Matching refs:lseg

307 init_lseg(struct pnfs_layout_hdr *lo, struct pnfs_layout_segment *lseg)  in init_lseg()  argument
309 INIT_LIST_HEAD(&lseg->pls_list); in init_lseg()
310 INIT_LIST_HEAD(&lseg->pls_lc_list); in init_lseg()
311 atomic_set(&lseg->pls_refcount, 1); in init_lseg()
313 set_bit(NFS_LSEG_VALID, &lseg->pls_flags); in init_lseg()
314 lseg->pls_layout = lo; in init_lseg()
317 static void pnfs_free_lseg(struct pnfs_layout_segment *lseg) in pnfs_free_lseg() argument
319 struct inode *ino = lseg->pls_layout->plh_inode; in pnfs_free_lseg()
321 NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg); in pnfs_free_lseg()
326 struct pnfs_layout_segment *lseg) in pnfs_layout_remove_lseg() argument
330 WARN_ON(test_bit(NFS_LSEG_VALID, &lseg->pls_flags)); in pnfs_layout_remove_lseg()
331 list_del_init(&lseg->pls_list); in pnfs_layout_remove_lseg()
340 pnfs_put_lseg(struct pnfs_layout_segment *lseg) in pnfs_put_lseg() argument
345 if (!lseg) in pnfs_put_lseg()
348 dprintk("%s: lseg %p ref %d valid %d\n", __func__, lseg, in pnfs_put_lseg()
349 atomic_read(&lseg->pls_refcount), in pnfs_put_lseg()
350 test_bit(NFS_LSEG_VALID, &lseg->pls_flags)); in pnfs_put_lseg()
351 lo = lseg->pls_layout; in pnfs_put_lseg()
353 if (atomic_dec_and_lock(&lseg->pls_refcount, &inode->i_lock)) { in pnfs_put_lseg()
355 pnfs_layout_remove_lseg(lo, lseg); in pnfs_put_lseg()
357 pnfs_free_lseg(lseg); in pnfs_put_lseg()
420 static bool pnfs_lseg_dec_and_remove_zero(struct pnfs_layout_segment *lseg, in pnfs_lseg_dec_and_remove_zero() argument
423 if (!atomic_dec_and_test(&lseg->pls_refcount)) in pnfs_lseg_dec_and_remove_zero()
425 pnfs_layout_remove_lseg(lseg->pls_layout, lseg); in pnfs_lseg_dec_and_remove_zero()
426 list_add(&lseg->pls_list, tmp_list); in pnfs_lseg_dec_and_remove_zero()
431 static int mark_lseg_invalid(struct pnfs_layout_segment *lseg, in mark_lseg_invalid() argument
436 if (test_and_clear_bit(NFS_LSEG_VALID, &lseg->pls_flags)) { in mark_lseg_invalid()
441 dprintk("%s: lseg %p ref %d\n", __func__, lseg, in mark_lseg_invalid()
442 atomic_read(&lseg->pls_refcount)); in mark_lseg_invalid()
443 if (pnfs_lseg_dec_and_remove_zero(lseg, tmp_list)) in mark_lseg_invalid()
457 struct pnfs_layout_segment *lseg, *next; in pnfs_mark_matching_lsegs_invalid() local
464 list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list) in pnfs_mark_matching_lsegs_invalid()
466 should_free_lseg(&lseg->pls_range, recall_range)) { in pnfs_mark_matching_lsegs_invalid()
469 lseg, lseg->pls_range.iomode, lseg->pls_range.offset, in pnfs_mark_matching_lsegs_invalid()
470 lseg->pls_range.length); in pnfs_mark_matching_lsegs_invalid()
472 removed += mark_lseg_invalid(lseg, tmp_list); in pnfs_mark_matching_lsegs_invalid()
482 struct pnfs_layout_segment *lseg, *tmp; in pnfs_free_lseg_list() local
487 list_for_each_entry_safe(lseg, tmp, free_me, pls_list) { in pnfs_free_lseg_list()
488 list_del(&lseg->pls_list); in pnfs_free_lseg_list()
489 pnfs_free_lseg(lseg); in pnfs_free_lseg_list()
752 struct pnfs_layout_segment *lseg; in send_layoutget() local
773 lseg = nfs4_proc_layoutget(lgp, gfp_flags); in send_layoutget()
774 if (IS_ERR(lseg)) { in send_layoutget()
775 switch (PTR_ERR(lseg)) { in send_layoutget()
786 return lseg; in send_layoutget()
793 struct pnfs_layout_segment *lseg, *tmp; in pnfs_clear_layoutcommit() local
797 list_for_each_entry_safe(lseg, tmp, &nfsi->layout->plh_segs, pls_list) { in pnfs_clear_layoutcommit()
798 if (!test_and_clear_bit(NFS_LSEG_LAYOUTCOMMIT, &lseg->pls_flags)) in pnfs_clear_layoutcommit()
800 pnfs_lseg_dec_and_remove_zero(lseg, head); in pnfs_clear_layoutcommit()
901 struct pnfs_layout_segment *lseg, *tmp; in pnfs_roc() local
910 list_for_each_entry_safe(lseg, tmp, &lo->plh_segs, pls_list) in pnfs_roc()
911 if (test_bit(NFS_LSEG_ROC, &lseg->pls_flags)) { in pnfs_roc()
912 mark_lseg_invalid(lseg, &tmp_list); in pnfs_roc()
958 struct pnfs_layout_segment *lseg; in pnfs_roc_drain() local
963 list_for_each_entry(lseg, &nfsi->layout->plh_segs, pls_list) in pnfs_roc_drain()
964 if (test_bit(NFS_LSEG_ROC, &lseg->pls_flags)) { in pnfs_roc_drain()
1008 struct pnfs_layout_segment *lseg) in pnfs_layout_insert_lseg() argument
1015 if (cmp_layout(&lseg->pls_range, &lp->pls_range) > 0) in pnfs_layout_insert_lseg()
1017 list_add_tail(&lseg->pls_list, &lp->pls_list); in pnfs_layout_insert_lseg()
1021 __func__, lseg, lseg->pls_range.iomode, in pnfs_layout_insert_lseg()
1022 lseg->pls_range.offset, lseg->pls_range.length, in pnfs_layout_insert_lseg()
1027 list_add_tail(&lseg->pls_list, &lo->plh_segs); in pnfs_layout_insert_lseg()
1030 __func__, lseg, lseg->pls_range.iomode, in pnfs_layout_insert_lseg()
1031 lseg->pls_range.offset, lseg->pls_range.length); in pnfs_layout_insert_lseg()
1118 struct pnfs_layout_segment *lseg, *ret = NULL; in pnfs_find_lseg() local
1122 list_for_each_entry(lseg, &lo->plh_segs, pls_list) { in pnfs_find_lseg()
1123 if (test_bit(NFS_LSEG_VALID, &lseg->pls_flags) && in pnfs_find_lseg()
1124 is_matching_lseg(&lseg->pls_range, range)) { in pnfs_find_lseg()
1125 ret = pnfs_get_lseg(lseg); in pnfs_find_lseg()
1128 if (lseg->pls_range.offset > range->offset) in pnfs_find_lseg()
1233 struct pnfs_layout_segment *lseg = NULL; in pnfs_update_layout() local
1260 lseg = pnfs_find_lseg(lo, &arg); in pnfs_update_layout()
1261 if (lseg) in pnfs_update_layout()
1288 lseg = send_layoutget(lo, ctx, &arg, gfp_flags); in pnfs_update_layout()
1297 lseg == NULL ? "not found" : "found", in pnfs_update_layout()
1301 return lseg; in pnfs_update_layout()
1313 struct pnfs_layout_segment *lseg; in pnfs_layout_process() local
1318 lseg = NFS_SERVER(ino)->pnfs_curr_ld->alloc_lseg(lo, res, lgp->gfp_flags); in pnfs_layout_process()
1319 if (!lseg || IS_ERR(lseg)) { in pnfs_layout_process()
1320 if (!lseg) in pnfs_layout_process()
1323 status = PTR_ERR(lseg); in pnfs_layout_process()
1344 init_lseg(lo, lseg); in pnfs_layout_process()
1345 lseg->pls_range = res->range; in pnfs_layout_process()
1346 pnfs_get_lseg(lseg); in pnfs_layout_process()
1347 pnfs_layout_insert_lseg(lo, lseg); in pnfs_layout_process()
1350 set_bit(NFS_LSEG_ROC, &lseg->pls_flags); in pnfs_layout_process()
1355 return lseg; in pnfs_layout_process()
1361 lseg->pls_layout = lo; in pnfs_layout_process()
1362 NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg); in pnfs_layout_process()
1553 struct pnfs_layout_segment *lseg, in pnfs_try_to_write_data() argument
1577 struct pnfs_layout_segment *lseg = desc->pg_lseg; in pnfs_do_multiple_writes() local
1586 trypnfs = pnfs_try_to_write_data(data, call_ops, lseg, how); in pnfs_do_multiple_writes()
1590 pnfs_put_lseg(lseg); in pnfs_do_multiple_writes()
1595 pnfs_put_lseg(hdr->lseg); in pnfs_writehdr_free()
1616 hdr->lseg = pnfs_get_lseg(desc->pg_lseg); in pnfs_generic_pg_writepages()
1710 struct pnfs_layout_segment *lseg) in pnfs_try_to_read_data() argument
1734 struct pnfs_layout_segment *lseg = desc->pg_lseg; in pnfs_do_multiple_reads() local
1743 trypnfs = pnfs_try_to_read_data(data, call_ops, lseg); in pnfs_do_multiple_reads()
1747 pnfs_put_lseg(lseg); in pnfs_do_multiple_reads()
1752 pnfs_put_lseg(hdr->lseg); in pnfs_readhdr_free()
1774 hdr->lseg = pnfs_get_lseg(desc->pg_lseg); in pnfs_generic_pg_readpages()
1793 struct pnfs_layout_segment *lseg; in pnfs_list_write_lseg() local
1795 list_for_each_entry(lseg, &NFS_I(inode)->layout->plh_segs, pls_list) { in pnfs_list_write_lseg()
1796 if (lseg->pls_range.iomode == IOMODE_RW && in pnfs_list_write_lseg()
1797 test_and_clear_bit(NFS_LSEG_LAYOUTCOMMIT, &lseg->pls_flags)) in pnfs_list_write_lseg()
1798 list_add(&lseg->pls_lc_list, listp); in pnfs_list_write_lseg()
1804 struct pnfs_layout_segment *lseg, *tmp; in pnfs_list_write_lseg_done() local
1808 list_for_each_entry_safe(lseg, tmp, listp, pls_lc_list) { in pnfs_list_write_lseg_done()
1809 list_del_init(&lseg->pls_lc_list); in pnfs_list_write_lseg_done()
1810 pnfs_put_lseg(lseg); in pnfs_list_write_lseg_done()
1818 void pnfs_set_lo_fail(struct pnfs_layout_segment *lseg) in pnfs_set_lo_fail() argument
1820 pnfs_layout_io_set_failed(lseg->pls_layout, lseg->pls_range.iomode); in pnfs_set_lo_fail()
1839 if (!test_and_set_bit(NFS_LSEG_LAYOUTCOMMIT, &hdr->lseg->pls_flags)) { in pnfs_set_layoutcommit()
1841 pnfs_get_lseg(hdr->lseg); in pnfs_set_layoutcommit()
1847 __func__, hdr->lseg, nfsi->layout->plh_lwb); in pnfs_set_layoutcommit()