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 ls->ls_layout_type = layout_type; in nfsd4_alloc_layout_stateid()
205 nfsd4_init_cb(&ls->ls_recall, clp, &nfsd4_cb_layout_ops, in nfsd4_alloc_layout_stateid()
209 ls->ls_file = get_file(fp->fi_deleg_file); in nfsd4_alloc_layout_stateid()
211 ls->ls_file = find_any_file(fp); in nfsd4_alloc_layout_stateid()
212 BUG_ON(!ls->ls_file); in nfsd4_alloc_layout_stateid()
214 if (nfsd4_layout_setlease(ls)) { in nfsd4_alloc_layout_stateid()
216 kmem_cache_free(nfs4_layout_stateid_cache, ls); in nfsd4_alloc_layout_stateid()
222 list_add(&ls->ls_perclnt, &clp->cl_lo_states); in nfsd4_alloc_layout_stateid()
226 list_add(&ls->ls_perfile, &fp->fi_lo_states); in nfsd4_alloc_layout_stateid()
229 trace_layoutstate_alloc(&ls->ls_stid.sc_stateid); in nfsd4_alloc_layout_stateid()
230 return ls; in nfsd4_alloc_layout_stateid()
238 struct nfs4_layout_stateid *ls; in nfsd4_preprocess_layout_stateid() local
258 ls = nfsd4_alloc_layout_stateid(cstate, stid, layout_type); in nfsd4_preprocess_layout_stateid()
262 if (!ls) in nfsd4_preprocess_layout_stateid()
265 ls = container_of(stid, struct nfs4_layout_stateid, ls_stid); in nfsd4_preprocess_layout_stateid()
270 if (layout_type != ls->ls_layout_type) in nfsd4_preprocess_layout_stateid()
274 *lsp = ls; in nfsd4_preprocess_layout_stateid()
284 nfsd4_recall_file_layout(struct nfs4_layout_stateid *ls) in nfsd4_recall_file_layout() argument
286 spin_lock(&ls->ls_lock); in nfsd4_recall_file_layout()
287 if (ls->ls_recalled) in nfsd4_recall_file_layout()
290 ls->ls_recalled = true; in nfsd4_recall_file_layout()
291 atomic_inc(&ls->ls_stid.sc_file->fi_lo_recalls); in nfsd4_recall_file_layout()
292 if (list_empty(&ls->ls_layouts)) in nfsd4_recall_file_layout()
295 trace_layout_recall(&ls->ls_stid.sc_stateid); in nfsd4_recall_file_layout()
297 atomic_inc(&ls->ls_stid.sc_count); in nfsd4_recall_file_layout()
298 update_stateid(&ls->ls_stid.sc_stateid); in nfsd4_recall_file_layout()
299 memcpy(&ls->ls_recall_sid, &ls->ls_stid.sc_stateid, sizeof(stateid_t)); in nfsd4_recall_file_layout()
300 nfsd4_run_cb(&ls->ls_recall); in nfsd4_recall_file_layout()
303 spin_unlock(&ls->ls_lock); in nfsd4_recall_file_layout()
350 nfsd4_recall_conflict(struct nfs4_layout_stateid *ls) in nfsd4_recall_conflict() argument
352 struct nfs4_file *fp = ls->ls_stid.sc_file; in nfsd4_recall_conflict()
359 if (l != ls) { in nfsd4_recall_conflict()
369 nfsd4_insert_layout(struct nfsd4_layoutget *lgp, struct nfs4_layout_stateid *ls) in nfsd4_insert_layout() argument
372 struct nfs4_file *fp = ls->ls_stid.sc_file; in nfsd4_insert_layout()
377 nfserr = nfsd4_recall_conflict(ls); in nfsd4_insert_layout()
380 spin_lock(&ls->ls_lock); in nfsd4_insert_layout()
381 list_for_each_entry(lp, &ls->ls_layouts, lo_perstate) { in nfsd4_insert_layout()
385 spin_unlock(&ls->ls_lock); in nfsd4_insert_layout()
392 new->lo_state = ls; in nfsd4_insert_layout()
395 nfserr = nfsd4_recall_conflict(ls); in nfsd4_insert_layout()
398 spin_lock(&ls->ls_lock); in nfsd4_insert_layout()
399 list_for_each_entry(lp, &ls->ls_layouts, lo_perstate) { in nfsd4_insert_layout()
404 atomic_inc(&ls->ls_stid.sc_count); in nfsd4_insert_layout()
405 list_add_tail(&new->lo_perstate, &ls->ls_layouts); in nfsd4_insert_layout()
408 update_stateid(&ls->ls_stid.sc_stateid); in nfsd4_insert_layout()
409 memcpy(&lgp->lg_sid, &ls->ls_stid.sc_stateid, sizeof(stateid_t)); in nfsd4_insert_layout()
410 spin_unlock(&ls->ls_lock); in nfsd4_insert_layout()
461 struct nfs4_layout_stateid *ls; in nfsd4_return_file_layouts() local
469 &ls); in nfsd4_return_file_layouts()
475 spin_lock(&ls->ls_lock); in nfsd4_return_file_layouts()
476 list_for_each_entry_safe(lp, n, &ls->ls_layouts, lo_perstate) { in nfsd4_return_file_layouts()
482 if (!list_empty(&ls->ls_layouts)) { in nfsd4_return_file_layouts()
484 update_stateid(&ls->ls_stid.sc_stateid); in nfsd4_return_file_layouts()
485 memcpy(&lrp->lr_sid, &ls->ls_stid.sc_stateid, 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 nfs4_put_stid(&ls->ls_stid); in nfsd4_return_file_layouts()
506 struct nfs4_layout_stateid *ls, *n; in nfsd4_return_client_layouts() local
514 list_for_each_entry_safe(ls, n, &clp->cl_lo_states, ls_perclnt) { in nfsd4_return_client_layouts()
515 if (ls->ls_layout_type != lrp->lr_layout_type) in nfsd4_return_client_layouts()
519 !fh_fsid_match(&ls->ls_stid.sc_file->fi_fhandle, in nfsd4_return_client_layouts()
523 spin_lock(&ls->ls_lock); in nfsd4_return_client_layouts()
524 list_for_each_entry_safe(lp, t, &ls->ls_layouts, lo_perstate) { in nfsd4_return_client_layouts()
529 spin_unlock(&ls->ls_lock); in nfsd4_return_client_layouts()
538 nfsd4_return_all_layouts(struct nfs4_layout_stateid *ls, in nfsd4_return_all_layouts() argument
541 spin_lock(&ls->ls_lock); in nfsd4_return_all_layouts()
542 list_splice_init(&ls->ls_layouts, reaplist); in nfsd4_return_all_layouts()
543 spin_unlock(&ls->ls_lock); in nfsd4_return_all_layouts()
549 struct nfs4_layout_stateid *ls, *n; in nfsd4_return_all_client_layouts() local
553 list_for_each_entry_safe(ls, n, &clp->cl_lo_states, ls_perclnt) in nfsd4_return_all_client_layouts()
554 nfsd4_return_all_layouts(ls, &reaplist); in nfsd4_return_all_client_layouts()
563 struct nfs4_layout_stateid *ls, *n; in nfsd4_return_all_file_layouts() local
567 list_for_each_entry_safe(ls, n, &fp->fi_lo_states, ls_perfile) { in nfsd4_return_all_file_layouts()
568 if (ls->ls_stid.sc_client == clp) in nfsd4_return_all_file_layouts()
569 nfsd4_return_all_layouts(ls, &reaplist); in nfsd4_return_all_file_layouts()
577 nfsd4_cb_layout_fail(struct nfs4_layout_stateid *ls) in nfsd4_cb_layout_fail() argument
579 struct nfs4_client *clp = ls->ls_stid.sc_client; in nfsd4_cb_layout_fail()
592 trace_layout_recall_fail(&ls->ls_stid.sc_stateid); in nfsd4_cb_layout_fail()
600 argv[2] = ls->ls_file->f_path.mnt->mnt_sb->s_id; in nfsd4_cb_layout_fail()
613 struct nfs4_layout_stateid *ls = in nfsd4_cb_layout_done() local
621 trace_layout_recall_done(&ls->ls_stid.sc_stateid); in nfsd4_cb_layout_done()
637 nfsd4_cb_layout_fail(ls); in nfsd4_cb_layout_done()
645 struct nfs4_layout_stateid *ls = in nfsd4_cb_layout_release() local
649 trace_layout_recall_release(&ls->ls_stid.sc_stateid); in nfsd4_cb_layout_release()
651 nfsd4_return_all_layouts(ls, &reaplist); in nfsd4_cb_layout_release()
653 nfs4_put_stid(&ls->ls_stid); in nfsd4_cb_layout_release()