Lines Matching full:mirror
50 struct nfs4_ff_layout_mirror *mirror);
205 struct nfs4_ff_layout_mirror *mirror) in ff_layout_add_mirror() argument
213 if (memcmp(&mirror->devid, &pos->devid, sizeof(pos->devid)) != 0) in ff_layout_add_mirror()
215 if (!ff_mirror_match_fh(mirror, pos)) in ff_layout_add_mirror()
222 list_add(&mirror->mirrors, &ff_layout->mirrors); in ff_layout_add_mirror()
223 mirror->layout = lo; in ff_layout_add_mirror()
225 return mirror; in ff_layout_add_mirror()
229 ff_layout_remove_mirror(struct nfs4_ff_layout_mirror *mirror) in ff_layout_remove_mirror() argument
232 if (mirror->layout == NULL) in ff_layout_remove_mirror()
234 inode = mirror->layout->plh_inode; in ff_layout_remove_mirror()
236 list_del(&mirror->mirrors); in ff_layout_remove_mirror()
238 mirror->layout = NULL; in ff_layout_remove_mirror()
243 struct nfs4_ff_layout_mirror *mirror; in ff_layout_alloc_mirror() local
245 mirror = kzalloc(sizeof(*mirror), gfp_flags); in ff_layout_alloc_mirror()
246 if (mirror != NULL) { in ff_layout_alloc_mirror()
247 spin_lock_init(&mirror->lock); in ff_layout_alloc_mirror()
248 refcount_set(&mirror->ref, 1); in ff_layout_alloc_mirror()
249 INIT_LIST_HEAD(&mirror->mirrors); in ff_layout_alloc_mirror()
251 return mirror; in ff_layout_alloc_mirror()
254 static void ff_layout_free_mirror(struct nfs4_ff_layout_mirror *mirror) in ff_layout_free_mirror() argument
258 ff_layout_remove_mirror(mirror); in ff_layout_free_mirror()
259 kfree(mirror->fh_versions); in ff_layout_free_mirror()
260 cred = rcu_access_pointer(mirror->ro_cred); in ff_layout_free_mirror()
262 cred = rcu_access_pointer(mirror->rw_cred); in ff_layout_free_mirror()
264 nfs4_ff_layout_put_deviceid(mirror->mirror_ds); in ff_layout_free_mirror()
265 kfree(mirror); in ff_layout_free_mirror()
268 static void ff_layout_put_mirror(struct nfs4_ff_layout_mirror *mirror) in ff_layout_put_mirror() argument
270 if (mirror != NULL && refcount_dec_and_test(&mirror->ref)) in ff_layout_put_mirror()
271 ff_layout_free_mirror(mirror); in ff_layout_put_mirror()
430 struct nfs4_ff_layout_mirror *mirror; in ff_layout_alloc_lseg() local
530 mirror = ff_layout_add_mirror(lh, fls->mirror_array[i]); in ff_layout_alloc_lseg()
531 if (mirror != fls->mirror_array[i]) { in ff_layout_alloc_lseg()
534 cred = xchg(&mirror->ro_cred, cred); in ff_layout_alloc_lseg()
537 cred = xchg(&mirror->rw_cred, cred); in ff_layout_alloc_lseg()
541 fls->mirror_array[i] = mirror; in ff_layout_alloc_lseg()
618 nfs4_ff_layoutstat_start_io(struct nfs4_ff_layout_mirror *mirror, in nfs4_ff_layoutstat_start_io() argument
623 struct nfs4_flexfile_layout *ffl = FF_LAYOUT_FROM_HDR(mirror->layout); in nfs4_ff_layoutstat_start_io()
626 if (!mirror->start_time) in nfs4_ff_layoutstat_start_io()
627 mirror->start_time = now; in nfs4_ff_layoutstat_start_io()
628 if (mirror->report_interval != 0) in nfs4_ff_layoutstat_start_io()
629 report_interval = (s64)mirror->report_interval * 1000LL; in nfs4_ff_layoutstat_start_io()
676 struct nfs4_ff_layout_mirror *mirror, in nfs4_ff_layout_stat_io_start_read() argument
681 spin_lock(&mirror->lock); in nfs4_ff_layout_stat_io_start_read()
682 report = nfs4_ff_layoutstat_start_io(mirror, &mirror->read_stat, now); in nfs4_ff_layout_stat_io_start_read()
683 nfs4_ff_layout_stat_io_update_requested(&mirror->read_stat, requested); in nfs4_ff_layout_stat_io_start_read()
684 set_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags); in nfs4_ff_layout_stat_io_start_read()
685 spin_unlock(&mirror->lock); in nfs4_ff_layout_stat_io_start_read()
693 struct nfs4_ff_layout_mirror *mirror, in nfs4_ff_layout_stat_io_end_read() argument
697 spin_lock(&mirror->lock); in nfs4_ff_layout_stat_io_end_read()
698 nfs4_ff_layout_stat_io_update_completed(&mirror->read_stat, in nfs4_ff_layout_stat_io_end_read()
701 set_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags); in nfs4_ff_layout_stat_io_end_read()
702 spin_unlock(&mirror->lock); in nfs4_ff_layout_stat_io_end_read()
707 struct nfs4_ff_layout_mirror *mirror, in nfs4_ff_layout_stat_io_start_write() argument
712 spin_lock(&mirror->lock); in nfs4_ff_layout_stat_io_start_write()
713 report = nfs4_ff_layoutstat_start_io(mirror , &mirror->write_stat, now); in nfs4_ff_layout_stat_io_start_write()
714 nfs4_ff_layout_stat_io_update_requested(&mirror->write_stat, requested); in nfs4_ff_layout_stat_io_start_write()
715 set_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags); in nfs4_ff_layout_stat_io_start_write()
716 spin_unlock(&mirror->lock); in nfs4_ff_layout_stat_io_start_write()
724 struct nfs4_ff_layout_mirror *mirror, in nfs4_ff_layout_stat_io_end_write() argument
732 spin_lock(&mirror->lock); in nfs4_ff_layout_stat_io_end_write()
733 nfs4_ff_layout_stat_io_update_completed(&mirror->write_stat, in nfs4_ff_layout_stat_io_end_write()
735 set_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags); in nfs4_ff_layout_stat_io_end_write()
736 spin_unlock(&mirror->lock); in nfs4_ff_layout_stat_io_end_write()
763 struct nfs4_ff_layout_mirror *mirror; in ff_layout_choose_ds_for_read() local
769 mirror = FF_LAYOUT_COMP(lseg, idx); in ff_layout_choose_ds_for_read()
770 ds = nfs4_ff_layout_prepare_ds(lseg, mirror, false); in ff_layout_choose_ds_for_read()
775 nfs4_test_deviceid_unavailable(&mirror->mirror_ds->id_node)) in ff_layout_choose_ds_for_read()
846 struct nfs4_ff_layout_mirror *mirror; in ff_layout_pg_init_read() local
874 mirror = FF_LAYOUT_COMP(pgio->pg_lseg, ds_idx); in ff_layout_pg_init_read()
876 pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize; in ff_layout_pg_init_read()
900 struct nfs4_ff_layout_mirror *mirror; in ff_layout_pg_init_write() local
927 mirror = FF_LAYOUT_COMP(pgio->pg_lseg, i); in ff_layout_pg_init_write()
928 ds = nfs4_ff_layout_prepare_ds(pgio->pg_lseg, mirror, true); in ff_layout_pg_init_write()
938 pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].wsize; in ff_layout_pg_init_write()
1236 struct nfs4_ff_layout_mirror *mirror; in ff_layout_io_track_ds_error() local
1268 mirror = FF_LAYOUT_COMP(lseg, idx); in ff_layout_io_track_ds_error()
1270 mirror, offset, length, status, opnum, in ff_layout_io_track_ds_error()
1776 struct nfs4_ff_layout_mirror *mirror; in ff_layout_read_pagelist() local
1787 mirror = FF_LAYOUT_COMP(lseg, idx); in ff_layout_read_pagelist()
1788 ds = nfs4_ff_layout_prepare_ds(lseg, mirror, false); in ff_layout_read_pagelist()
1792 ds_clnt = nfs4_ff_find_or_create_ds_client(mirror, ds->ds_clp, in ff_layout_read_pagelist()
1797 ds_cred = ff_layout_get_ds_cred(mirror, &lseg->pls_range, hdr->cred); in ff_layout_read_pagelist()
1801 vers = nfs4_ff_layout_ds_version(mirror); in ff_layout_read_pagelist()
1809 fh = nfs4_ff_layout_select_ds_fh(mirror); in ff_layout_read_pagelist()
1813 nfs4_ff_layout_select_ds_stateid(mirror, &hdr->args.stateid); in ff_layout_read_pagelist()
1854 struct nfs4_ff_layout_mirror *mirror; in ff_layout_write_pagelist() local
1861 mirror = FF_LAYOUT_COMP(lseg, idx); in ff_layout_write_pagelist()
1862 ds = nfs4_ff_layout_prepare_ds(lseg, mirror, true); in ff_layout_write_pagelist()
1866 ds_clnt = nfs4_ff_find_or_create_ds_client(mirror, ds->ds_clp, in ff_layout_write_pagelist()
1871 ds_cred = ff_layout_get_ds_cred(mirror, &lseg->pls_range, hdr->cred); in ff_layout_write_pagelist()
1875 vers = nfs4_ff_layout_ds_version(mirror); in ff_layout_write_pagelist()
1886 fh = nfs4_ff_layout_select_ds_fh(mirror); in ff_layout_write_pagelist()
1890 nfs4_ff_layout_select_ds_stateid(mirror, &hdr->args.stateid); in ff_layout_write_pagelist()
1945 struct nfs4_ff_layout_mirror *mirror; in ff_layout_initiate_commit() local
1956 mirror = FF_LAYOUT_COMP(lseg, idx); in ff_layout_initiate_commit()
1957 ds = nfs4_ff_layout_prepare_ds(lseg, mirror, true); in ff_layout_initiate_commit()
1961 ds_clnt = nfs4_ff_find_or_create_ds_client(mirror, ds->ds_clp, in ff_layout_initiate_commit()
1966 ds_cred = ff_layout_get_ds_cred(mirror, &lseg->pls_range, data->cred); in ff_layout_initiate_commit()
1970 vers = nfs4_ff_layout_ds_version(mirror); in ff_layout_initiate_commit()
2043 struct nfs4_ff_layout_mirror *mirror; in ff_layout_cancel_io() local
2051 mirror = flseg->mirror_array[idx]; in ff_layout_cancel_io()
2052 mirror_ds = mirror->mirror_ds; in ff_layout_cancel_io()
2055 ds = mirror->mirror_ds->ds; in ff_layout_cancel_io()
2453 struct nfs4_ff_layout_mirror *mirror) in ff_layout_encode_ff_layoutupdate() argument
2456 struct nfs4_pnfs_ds *ds = mirror->mirror_ds->ds; in ff_layout_encode_ff_layoutupdate()
2457 struct nfs_fh *fh = &mirror->fh_versions[0]; in ff_layout_encode_ff_layoutupdate()
2469 spin_lock(&mirror->lock); in ff_layout_encode_ff_layoutupdate()
2470 ff_layout_encode_io_latency(xdr, &mirror->read_stat.io_stat); in ff_layout_encode_ff_layoutupdate()
2472 ff_layout_encode_io_latency(xdr, &mirror->write_stat.io_stat); in ff_layout_encode_ff_layoutupdate()
2473 spin_unlock(&mirror->lock); in ff_layout_encode_ff_layoutupdate()
2475 ff_layout_encode_nfstime(xdr, ktime_sub(ktime_get(), mirror->start_time)); in ff_layout_encode_ff_layoutupdate()
2499 struct nfs4_ff_layout_mirror *mirror = opaque->data; in ff_layout_free_layoutstats() local
2501 ff_layout_put_mirror(mirror); in ff_layout_free_layoutstats()
2515 struct nfs4_ff_layout_mirror *mirror; in ff_layout_mirror_prepare_stats() local
2519 list_for_each_entry(mirror, &ff_layout->mirrors, mirrors) { in ff_layout_mirror_prepare_stats()
2522 if (IS_ERR_OR_NULL(mirror->mirror_ds)) in ff_layout_mirror_prepare_stats()
2525 &mirror->flags) && in ff_layout_mirror_prepare_stats()
2528 /* mirror refcount put in cleanup_layoutstats */ in ff_layout_mirror_prepare_stats()
2529 if (!refcount_inc_not_zero(&mirror->ref)) in ff_layout_mirror_prepare_stats()
2531 dev = &mirror->mirror_ds->id_node; in ff_layout_mirror_prepare_stats()
2535 spin_lock(&mirror->lock); in ff_layout_mirror_prepare_stats()
2536 devinfo->read_count = mirror->read_stat.io_stat.ops_completed; in ff_layout_mirror_prepare_stats()
2537 devinfo->read_bytes = mirror->read_stat.io_stat.bytes_completed; in ff_layout_mirror_prepare_stats()
2538 devinfo->write_count = mirror->write_stat.io_stat.ops_completed; in ff_layout_mirror_prepare_stats()
2539 devinfo->write_bytes = mirror->write_stat.io_stat.bytes_completed; in ff_layout_mirror_prepare_stats()
2540 spin_unlock(&mirror->lock); in ff_layout_mirror_prepare_stats()
2543 devinfo->ld_private.data = mirror; in ff_layout_mirror_prepare_stats()