Lines Matching refs:ls
133 struct nfs4_layout_stateid *ls = layoutstateid(stid); in nfsd4_free_layout_stateid() local
134 struct nfs4_client *clp = ls->ls_stid.sc_client; in nfsd4_free_layout_stateid()
135 struct nfs4_file *fp = ls->ls_stid.sc_file; in nfsd4_free_layout_stateid()
137 trace_layoutstate_free(&ls->ls_stid.sc_stateid); in nfsd4_free_layout_stateid()
140 list_del_init(&ls->ls_perclnt); in nfsd4_free_layout_stateid()
144 list_del_init(&ls->ls_perfile); in nfsd4_free_layout_stateid()
147 vfs_setlease(ls->ls_file, F_UNLCK, NULL, (void **)&ls); in nfsd4_free_layout_stateid()
148 fput(ls->ls_file); in nfsd4_free_layout_stateid()
150 if (ls->ls_recalled) in nfsd4_free_layout_stateid()
151 atomic_dec(&ls->ls_stid.sc_file->fi_lo_recalls); in nfsd4_free_layout_stateid()
153 kmem_cache_free(nfs4_layout_stateid_cache, ls); in nfsd4_free_layout_stateid()
157 nfsd4_layout_setlease(struct nfs4_layout_stateid *ls) in nfsd4_layout_setlease() argument
170 fl->fl_owner = ls; in nfsd4_layout_setlease()
172 fl->fl_file = ls->ls_file; in nfsd4_layout_setlease()
189 struct nfs4_layout_stateid *ls; in nfsd4_alloc_layout_stateid() local
199 ls = layoutstateid(stp); in nfsd4_alloc_layout_stateid()
200 INIT_LIST_HEAD(&ls->ls_perclnt); in nfsd4_alloc_layout_stateid()
201 INIT_LIST_HEAD(&ls->ls_perfile); in nfsd4_alloc_layout_stateid()
202 spin_lock_init(&ls->ls_lock); in nfsd4_alloc_layout_stateid()
203 INIT_LIST_HEAD(&ls->ls_layouts); in nfsd4_alloc_layout_stateid()
204 mutex_init(&ls->ls_mutex); in nfsd4_alloc_layout_stateid()
205 ls->ls_layout_type = layout_type; in nfsd4_alloc_layout_stateid()
206 nfsd4_init_cb(&ls->ls_recall, clp, &nfsd4_cb_layout_ops, in nfsd4_alloc_layout_stateid()
210 ls->ls_file = get_file(fp->fi_deleg_file); in nfsd4_alloc_layout_stateid()
212 ls->ls_file = find_any_file(fp); in nfsd4_alloc_layout_stateid()
213 BUG_ON(!ls->ls_file); in nfsd4_alloc_layout_stateid()
215 if (nfsd4_layout_setlease(ls)) { in nfsd4_alloc_layout_stateid()
216 fput(ls->ls_file); in nfsd4_alloc_layout_stateid()
218 kmem_cache_free(nfs4_layout_stateid_cache, ls); in nfsd4_alloc_layout_stateid()
224 list_add(&ls->ls_perclnt, &clp->cl_lo_states); in nfsd4_alloc_layout_stateid()
228 list_add(&ls->ls_perfile, &fp->fi_lo_states); in nfsd4_alloc_layout_stateid()
231 trace_layoutstate_alloc(&ls->ls_stid.sc_stateid); in nfsd4_alloc_layout_stateid()
232 return ls; in nfsd4_alloc_layout_stateid()
240 struct nfs4_layout_stateid *ls; in nfsd4_preprocess_layout_stateid() local
260 ls = nfsd4_alloc_layout_stateid(cstate, stid, layout_type); in nfsd4_preprocess_layout_stateid()
264 if (!ls) in nfsd4_preprocess_layout_stateid()
266 mutex_lock(&ls->ls_mutex); in nfsd4_preprocess_layout_stateid()
268 ls = container_of(stid, struct nfs4_layout_stateid, ls_stid); in nfsd4_preprocess_layout_stateid()
271 mutex_lock(&ls->ls_mutex); in nfsd4_preprocess_layout_stateid()
274 if (layout_type != ls->ls_layout_type) in nfsd4_preprocess_layout_stateid()
278 *lsp = ls; in nfsd4_preprocess_layout_stateid()
282 mutex_unlock(&ls->ls_mutex); in nfsd4_preprocess_layout_stateid()
290 nfsd4_recall_file_layout(struct nfs4_layout_stateid *ls) in nfsd4_recall_file_layout() argument
292 spin_lock(&ls->ls_lock); in nfsd4_recall_file_layout()
293 if (ls->ls_recalled) in nfsd4_recall_file_layout()
296 ls->ls_recalled = true; in nfsd4_recall_file_layout()
297 atomic_inc(&ls->ls_stid.sc_file->fi_lo_recalls); in nfsd4_recall_file_layout()
298 if (list_empty(&ls->ls_layouts)) in nfsd4_recall_file_layout()
301 trace_layout_recall(&ls->ls_stid.sc_stateid); in nfsd4_recall_file_layout()
303 atomic_inc(&ls->ls_stid.sc_count); in nfsd4_recall_file_layout()
304 nfsd4_run_cb(&ls->ls_recall); in nfsd4_recall_file_layout()
307 spin_unlock(&ls->ls_lock); in nfsd4_recall_file_layout()
354 nfsd4_recall_conflict(struct nfs4_layout_stateid *ls) in nfsd4_recall_conflict() argument
356 struct nfs4_file *fp = ls->ls_stid.sc_file; in nfsd4_recall_conflict()
363 if (l != ls) { in nfsd4_recall_conflict()
373 nfsd4_insert_layout(struct nfsd4_layoutget *lgp, struct nfs4_layout_stateid *ls) in nfsd4_insert_layout() argument
376 struct nfs4_file *fp = ls->ls_stid.sc_file; in nfsd4_insert_layout()
381 nfserr = nfsd4_recall_conflict(ls); in nfsd4_insert_layout()
384 spin_lock(&ls->ls_lock); in nfsd4_insert_layout()
385 list_for_each_entry(lp, &ls->ls_layouts, lo_perstate) { in nfsd4_insert_layout()
389 spin_unlock(&ls->ls_lock); in nfsd4_insert_layout()
396 new->lo_state = ls; in nfsd4_insert_layout()
399 nfserr = nfsd4_recall_conflict(ls); in nfsd4_insert_layout()
402 spin_lock(&ls->ls_lock); in nfsd4_insert_layout()
403 list_for_each_entry(lp, &ls->ls_layouts, lo_perstate) { in nfsd4_insert_layout()
408 atomic_inc(&ls->ls_stid.sc_count); in nfsd4_insert_layout()
409 list_add_tail(&new->lo_perstate, &ls->ls_layouts); in nfsd4_insert_layout()
412 nfs4_inc_and_copy_stateid(&lgp->lg_sid, &ls->ls_stid); in nfsd4_insert_layout()
413 spin_unlock(&ls->ls_lock); in nfsd4_insert_layout()
464 struct nfs4_layout_stateid *ls; in nfsd4_return_file_layouts() local
472 &ls); in nfsd4_return_file_layouts()
478 spin_lock(&ls->ls_lock); in nfsd4_return_file_layouts()
479 list_for_each_entry_safe(lp, n, &ls->ls_layouts, lo_perstate) { in nfsd4_return_file_layouts()
485 if (!list_empty(&ls->ls_layouts)) { in nfsd4_return_file_layouts()
487 nfs4_inc_and_copy_stateid(&lrp->lr_sid, &ls->ls_stid); in nfsd4_return_file_layouts()
490 trace_layoutstate_unhash(&ls->ls_stid.sc_stateid); in nfsd4_return_file_layouts()
491 nfs4_unhash_stid(&ls->ls_stid); in nfsd4_return_file_layouts()
494 spin_unlock(&ls->ls_lock); in nfsd4_return_file_layouts()
496 mutex_unlock(&ls->ls_mutex); in nfsd4_return_file_layouts()
497 nfs4_put_stid(&ls->ls_stid); in nfsd4_return_file_layouts()
507 struct nfs4_layout_stateid *ls, *n; in nfsd4_return_client_layouts() local
515 list_for_each_entry_safe(ls, n, &clp->cl_lo_states, ls_perclnt) { in nfsd4_return_client_layouts()
516 if (ls->ls_layout_type != lrp->lr_layout_type) in nfsd4_return_client_layouts()
520 !fh_fsid_match(&ls->ls_stid.sc_file->fi_fhandle, in nfsd4_return_client_layouts()
524 spin_lock(&ls->ls_lock); in nfsd4_return_client_layouts()
525 list_for_each_entry_safe(lp, t, &ls->ls_layouts, lo_perstate) { in nfsd4_return_client_layouts()
530 spin_unlock(&ls->ls_lock); in nfsd4_return_client_layouts()
539 nfsd4_return_all_layouts(struct nfs4_layout_stateid *ls, in nfsd4_return_all_layouts() argument
542 spin_lock(&ls->ls_lock); in nfsd4_return_all_layouts()
543 list_splice_init(&ls->ls_layouts, reaplist); in nfsd4_return_all_layouts()
544 spin_unlock(&ls->ls_lock); in nfsd4_return_all_layouts()
550 struct nfs4_layout_stateid *ls, *n; in nfsd4_return_all_client_layouts() local
554 list_for_each_entry_safe(ls, n, &clp->cl_lo_states, ls_perclnt) in nfsd4_return_all_client_layouts()
555 nfsd4_return_all_layouts(ls, &reaplist); in nfsd4_return_all_client_layouts()
564 struct nfs4_layout_stateid *ls, *n; in nfsd4_return_all_file_layouts() local
568 list_for_each_entry_safe(ls, n, &fp->fi_lo_states, ls_perfile) { in nfsd4_return_all_file_layouts()
569 if (ls->ls_stid.sc_client == clp) in nfsd4_return_all_file_layouts()
570 nfsd4_return_all_layouts(ls, &reaplist); in nfsd4_return_all_file_layouts()
578 nfsd4_cb_layout_fail(struct nfs4_layout_stateid *ls) in nfsd4_cb_layout_fail() argument
580 struct nfs4_client *clp = ls->ls_stid.sc_client; in nfsd4_cb_layout_fail()
593 trace_layout_recall_fail(&ls->ls_stid.sc_stateid); in nfsd4_cb_layout_fail()
601 argv[2] = ls->ls_file->f_path.mnt->mnt_sb->s_id; in nfsd4_cb_layout_fail()
614 struct nfs4_layout_stateid *ls = in nfsd4_cb_layout_prepare() local
617 mutex_lock(&ls->ls_mutex); in nfsd4_cb_layout_prepare()
618 nfs4_inc_and_copy_stateid(&ls->ls_recall_sid, &ls->ls_stid); in nfsd4_cb_layout_prepare()
619 mutex_unlock(&ls->ls_mutex); in nfsd4_cb_layout_prepare()
625 struct nfs4_layout_stateid *ls = in nfsd4_cb_layout_done() local
633 trace_layout_recall_done(&ls->ls_stid.sc_stateid); in nfsd4_cb_layout_done()
649 nfsd4_cb_layout_fail(ls); in nfsd4_cb_layout_done()
657 struct nfs4_layout_stateid *ls = in nfsd4_cb_layout_release() local
661 trace_layout_recall_release(&ls->ls_stid.sc_stateid); in nfsd4_cb_layout_release()
663 nfsd4_return_all_layouts(ls, &reaplist); in nfsd4_cb_layout_release()
665 nfs4_put_stid(&ls->ls_stid); in nfsd4_cb_layout_release()