Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc7ff367 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

pNFS: If we have to delay the layout callback, mark the layout for return



If the client needs to delay the layout callback, then speed up the recall
process by marking the remaining layout segments to be actively returned
by the client.

Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 0654cc72
Loading
Loading
Loading
Loading
+12 −2
Original line number Original line Diff line number Diff line
@@ -181,9 +181,19 @@ static u32 initiate_file_draining(struct nfs_client *clp,
	pnfs_layoutcommit_inode(ino, false);
	pnfs_layoutcommit_inode(ino, false);


	spin_lock(&ino->i_lock);
	spin_lock(&ino->i_lock);
	if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags) ||
	/*
	    pnfs_mark_matching_lsegs_invalid(lo, &free_me_list,
	 * Enforce RFC5661 Section 12.5.5.2.1.5 (Bulk Recall and Return)
	 */
	if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) {
		rv = NFS4ERR_DELAY;
		goto unlock;
	}

	if (pnfs_mark_matching_lsegs_invalid(lo, &free_me_list,
					&args->cbl_range)) {
					&args->cbl_range)) {
		pnfs_mark_matching_lsegs_return(lo,
				&free_me_list,
				&args->cbl_range);
		rv = NFS4ERR_DELAY;
		rv = NFS4ERR_DELAY;
		goto unlock;
		goto unlock;
	}
	}
+3 −1
Original line number Original line Diff line number Diff line
@@ -1756,7 +1756,7 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
	goto out;
	goto out;
}
}


static void
void
pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
				struct list_head *tmp_list,
				struct list_head *tmp_list,
				struct pnfs_layout_range *return_range)
				struct pnfs_layout_range *return_range)
@@ -1768,6 +1768,8 @@ pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
	if (list_empty(&lo->plh_segs))
	if (list_empty(&lo->plh_segs))
		return;
		return;


	assert_spin_locked(&lo->plh_inode->i_lock);

	list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list)
	list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list)
		if (should_free_lseg(&lseg->pls_range, return_range)) {
		if (should_free_lseg(&lseg->pls_range, return_range)) {
			dprintk("%s: marking lseg %p iomode %d "
			dprintk("%s: marking lseg %p iomode %d "
+3 −0
Original line number Original line Diff line number Diff line
@@ -266,6 +266,9 @@ int pnfs_choose_layoutget_stateid(nfs4_stateid *dst,
int pnfs_mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
int pnfs_mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
				struct list_head *tmp_list,
				struct list_head *tmp_list,
				struct pnfs_layout_range *recall_range);
				struct pnfs_layout_range *recall_range);
void pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
				struct list_head *tmp_list,
				struct pnfs_layout_range *recall_range);
bool pnfs_roc(struct inode *ino);
bool pnfs_roc(struct inode *ino);
void pnfs_roc_release(struct inode *ino);
void pnfs_roc_release(struct inode *ino);
void pnfs_roc_set_barrier(struct inode *ino, u32 barrier);
void pnfs_roc_set_barrier(struct inode *ino, u32 barrier);