Lines Matching refs:fls
252 static void ff_layout_free_mirror_array(struct nfs4_ff_layout_segment *fls) in ff_layout_free_mirror_array() argument
256 for (i = 0; i < fls->mirror_array_cnt; i++) in ff_layout_free_mirror_array()
257 ff_layout_put_mirror(fls->mirror_array[i]); in ff_layout_free_mirror_array()
260 static void _ff_layout_free_lseg(struct nfs4_ff_layout_segment *fls) in _ff_layout_free_lseg() argument
262 if (fls) { in _ff_layout_free_lseg()
263 ff_layout_free_mirror_array(fls); in _ff_layout_free_lseg()
264 kfree(fls); in _ff_layout_free_lseg()
346 static void ff_layout_sort_mirrors(struct nfs4_ff_layout_segment *fls) in ff_layout_sort_mirrors() argument
350 for (i = 0; i < fls->mirror_array_cnt - 1; i++) { in ff_layout_sort_mirrors()
351 for (j = i + 1; j < fls->mirror_array_cnt; j++) in ff_layout_sort_mirrors()
352 if (fls->mirror_array[i]->efficiency < in ff_layout_sort_mirrors()
353 fls->mirror_array[j]->efficiency) in ff_layout_sort_mirrors()
354 swap(fls->mirror_array[i], in ff_layout_sort_mirrors()
355 fls->mirror_array[j]); in ff_layout_sort_mirrors()
365 struct nfs4_ff_layout_segment *fls = NULL; in ff_layout_alloc_lseg() local
399 fls = kzalloc(struct_size(fls, mirror_array, mirror_array_cnt), in ff_layout_alloc_lseg()
401 if (!fls) in ff_layout_alloc_lseg()
404 fls->mirror_array_cnt = mirror_array_cnt; in ff_layout_alloc_lseg()
405 fls->stripe_unit = stripe_unit; in ff_layout_alloc_lseg()
407 for (i = 0; i < fls->mirror_array_cnt; i++) { in ff_layout_alloc_lseg()
426 fls->mirror_array[i] = ff_layout_alloc_mirror(gfp_flags); in ff_layout_alloc_lseg()
427 if (fls->mirror_array[i] == NULL) { in ff_layout_alloc_lseg()
432 fls->mirror_array[i]->ds_count = ds_count; in ff_layout_alloc_lseg()
435 rc = decode_deviceid(&stream, &fls->mirror_array[i]->devid); in ff_layout_alloc_lseg()
444 fls->mirror_array[i]->efficiency = be32_to_cpup(p); in ff_layout_alloc_lseg()
447 rc = decode_pnfs_stateid(&stream, &fls->mirror_array[i]->stateid); in ff_layout_alloc_lseg()
458 fls->mirror_array[i]->fh_versions = in ff_layout_alloc_lseg()
461 if (fls->mirror_array[i]->fh_versions == NULL) { in ff_layout_alloc_lseg()
468 &fls->mirror_array[i]->fh_versions[j]); in ff_layout_alloc_lseg()
473 fls->mirror_array[i]->fh_versions_cnt = fh_count; in ff_layout_alloc_lseg()
504 rcu_assign_pointer(fls->mirror_array[i]->ro_cred, cred); in ff_layout_alloc_lseg()
506 rcu_assign_pointer(fls->mirror_array[i]->rw_cred, cred); in ff_layout_alloc_lseg()
508 mirror = ff_layout_add_mirror(lh, fls->mirror_array[i]); in ff_layout_alloc_lseg()
509 if (mirror != fls->mirror_array[i]) { in ff_layout_alloc_lseg()
513 rcu_assign_pointer(fls->mirror_array[i]->ro_cred, cred); in ff_layout_alloc_lseg()
516 rcu_assign_pointer(fls->mirror_array[i]->rw_cred, cred); in ff_layout_alloc_lseg()
518 ff_layout_free_mirror(fls->mirror_array[i]); in ff_layout_alloc_lseg()
519 fls->mirror_array[i] = mirror; in ff_layout_alloc_lseg()
531 fls->flags = be32_to_cpup(p); in ff_layout_alloc_lseg()
536 for (i=0; i < fls->mirror_array_cnt; i++) in ff_layout_alloc_lseg()
537 fls->mirror_array[i]->report_interval = be32_to_cpup(p); in ff_layout_alloc_lseg()
540 ff_layout_sort_mirrors(fls); in ff_layout_alloc_lseg()
541 ret = &fls->generic_hdr; in ff_layout_alloc_lseg()
547 _ff_layout_free_lseg(fls); in ff_layout_alloc_lseg()
556 struct nfs4_ff_layout_segment *fls = FF_LAYOUT_LSEG(lseg); in ff_layout_free_lseg() local
570 _ff_layout_free_lseg(fls); in ff_layout_free_lseg()
740 struct nfs4_ff_layout_segment *fls = FF_LAYOUT_LSEG(lseg); in ff_layout_choose_ds_for_read() local
747 for (idx = start_idx; idx < fls->mirror_array_cnt; idx++) { in ff_layout_choose_ds_for_read()
748 if (idx+1 == fls->mirror_array_cnt) in ff_layout_choose_ds_for_read()