aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-02-15 12:36:04 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2016-02-15 12:56:01 -0500
commit2f21596882f4a0edc387051910d56f8732970080 (patch)
treefce3aeb1615a6b37e9e69185d2588cbdef1faaf4
parent50ab8ec74a153eb30db26529088bc57dd700b24c (diff)
pNFS: Fix pnfs_mark_matching_lsegs_return()
We don't need to schedule a layoutreturn if the layout segment can be freed immediately. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r--fs/nfs/pnfs.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 482b6e94bb37..8d9fa4e40e89 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1740,6 +1740,16 @@ pnfs_set_plh_return_iomode(struct pnfs_layout_hdr *lo, enum pnfs_iomode iomode)
1740 lo->plh_return_iomode = iomode; 1740 lo->plh_return_iomode = iomode;
1741} 1741}
1742 1742
1743/**
1744 * pnfs_mark_matching_lsegs_return - Free or return matching layout segments
1745 * @lo: pointer to layout header
1746 * @tmp_list: list header to be used with pnfs_free_lseg_list()
1747 * @return_range: describe layout segment ranges to be returned
1748 *
1749 * This function is mainly intended for use by layoutrecall. It attempts
1750 * to free the layout segment immediately, or else to mark it for return
1751 * as soon as its reference count drops to zero.
1752 */
1743int 1753int
1744pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo, 1754pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
1745 struct list_head *tmp_list, 1755 struct list_head *tmp_list,
@@ -1762,10 +1772,11 @@ pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
1762 lseg, lseg->pls_range.iomode, 1772 lseg, lseg->pls_range.iomode,
1763 lseg->pls_range.offset, 1773 lseg->pls_range.offset,
1764 lseg->pls_range.length); 1774 lseg->pls_range.length);
1775 if (mark_lseg_invalid(lseg, tmp_list))
1776 continue;
1777 remaining++;
1765 set_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags); 1778 set_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags);
1766 pnfs_set_plh_return_iomode(lo, return_range->iomode); 1779 pnfs_set_plh_return_iomode(lo, return_range->iomode);
1767 if (!mark_lseg_invalid(lseg, tmp_list))
1768 remaining++;
1769 set_bit(NFS_LAYOUT_RETURN_REQUESTED, 1780 set_bit(NFS_LAYOUT_RETURN_REQUESTED,
1770 &lo->plh_flags); 1781 &lo->plh_flags);
1771 } 1782 }