Lines Matching +full:1 +full:- +full:cell

105 	ret = -ENOMEM;  in afs_fs_init()
158 struct afs_super_info *as = AFS_FS_S(root->d_sb); in afs_show_devname()
159 struct afs_volume *volume = as->volume; in afs_show_devname()
160 struct afs_cell *cell = as->cell; in afs_show_devname() local
164 if (as->dyn_root) { in afs_show_devname()
169 switch (volume->type) { in afs_show_devname()
174 if (volume->type_force) in afs_show_devname()
183 seq_printf(m, "%c%s:%s%s", pref, cell->name, volume->name, suf); in afs_show_devname()
192 struct afs_super_info *as = AFS_FS_S(root->d_sb); in afs_show_options()
195 if (as->dyn_root) in afs_show_options()
197 switch (as->flock_mode) { in afs_show_options()
211 * Parse the source name to get cell name, volume name, volume type and R/W
215 * "%[cell:]volume[.]" R/W volume
216 * "#[cell:]volume[.]" R/O or R/W volume (R/O parent),
218 * "%[cell:]volume.readonly" R/O volume
219 * "#[cell:]volume.readonly" R/O volume
220 * "%[cell:]volume.backup" Backup volume
221 * "#[cell:]volume.backup" Backup volume
225 struct afs_fs_context *ctx = fc->fs_private; in afs_parse_source()
226 struct afs_cell *cell; in afs_parse_source() local
227 const char *cellname, *suffix, *name = param->string; in afs_parse_source()
232 if (fc->source) in afs_parse_source()
237 return -EINVAL; in afs_parse_source()
240 if ((name[0] != '%' && name[0] != '#') || !name[1]) { in afs_parse_source()
243 ctx->no_cell = true; in afs_parse_source()
247 return -EINVAL; in afs_parse_source()
252 ctx->type = AFSVL_RWVOL; in afs_parse_source()
253 ctx->force = true; in afs_parse_source()
257 /* split the cell name out if there is one */ in afs_parse_source()
258 ctx->volname = strchr(name, ':'); in afs_parse_source()
259 if (ctx->volname) { in afs_parse_source()
261 cellnamesz = ctx->volname - name; in afs_parse_source()
262 ctx->volname++; in afs_parse_source()
264 ctx->volname = name; in afs_parse_source()
270 suffix = strrchr(ctx->volname, '.'); in afs_parse_source()
273 ctx->type = AFSVL_ROVOL; in afs_parse_source()
274 ctx->force = true; in afs_parse_source()
276 ctx->type = AFSVL_BACKVOL; in afs_parse_source()
277 ctx->force = true; in afs_parse_source()
278 } else if (suffix[1] == 0) { in afs_parse_source()
284 ctx->volnamesz = suffix ? in afs_parse_source()
285 suffix - ctx->volname : strlen(ctx->volname); in afs_parse_source()
287 _debug("cell %*.*s [%p]", in afs_parse_source()
288 cellnamesz, cellnamesz, cellname ?: "", ctx->cell); in afs_parse_source()
290 /* lookup the cell record */ in afs_parse_source()
292 cell = afs_lookup_cell(ctx->net, cellname, cellnamesz, in afs_parse_source()
295 if (IS_ERR(cell)) { in afs_parse_source()
296 pr_err("kAFS: unable to lookup cell '%*.*s'\n", in afs_parse_source()
298 return PTR_ERR(cell); in afs_parse_source()
300 afs_unuse_cell(ctx->cell, afs_cell_trace_unuse_parse); in afs_parse_source()
301 afs_see_cell(cell, afs_cell_trace_see_source); in afs_parse_source()
302 ctx->cell = cell; in afs_parse_source()
305 _debug("CELL:%s [%p] VOLUME:%*.*s SUFFIX:%s TYPE:%d%s", in afs_parse_source()
306 ctx->cell->name, ctx->cell, in afs_parse_source()
307 ctx->volnamesz, ctx->volnamesz, ctx->volname, in afs_parse_source()
308 suffix ?: "-", ctx->type, ctx->force ? " FORCE" : ""); in afs_parse_source()
310 fc->source = param->string; in afs_parse_source()
311 param->string = NULL; in afs_parse_source()
321 struct afs_fs_context *ctx = fc->fs_private; in afs_parse_param()
333 ctx->autocell = true; in afs_parse_param()
337 ctx->dyn_root = true; in afs_parse_param()
341 ctx->flock_mode = result.uint_32; in afs_parse_param()
345 return -EINVAL; in afs_parse_param()
353 * Validate the options, get the cell key and look up the volume.
357 struct afs_fs_context *ctx = fc->fs_private; in afs_validate_fc()
359 struct afs_cell *cell; in afs_validate_fc() local
363 if (!ctx->dyn_root) { in afs_validate_fc()
364 if (ctx->no_cell) { in afs_validate_fc()
365 pr_warn("kAFS: Can only specify source 'none' with -o dyn\n"); in afs_validate_fc()
366 return -EINVAL; in afs_validate_fc()
369 if (!ctx->cell) { in afs_validate_fc()
370 pr_warn("kAFS: No cell specified\n"); in afs_validate_fc()
371 return -EDESTADDRREQ; in afs_validate_fc()
376 key = afs_request_key(ctx->cell); in afs_validate_fc()
380 ctx->key = key; in afs_validate_fc()
382 if (ctx->volume) { in afs_validate_fc()
383 afs_put_volume(ctx->volume, afs_volume_trace_put_validate_fc); in afs_validate_fc()
384 ctx->volume = NULL; in afs_validate_fc()
387 if (test_bit(AFS_CELL_FL_CHECK_ALIAS, &ctx->cell->flags)) { in afs_validate_fc()
388 ret = afs_cell_detect_alias(ctx->cell, key); in afs_validate_fc()
391 if (ret == 1) { in afs_validate_fc()
393 key_put(ctx->key); in afs_validate_fc()
394 ctx->key = NULL; in afs_validate_fc()
395 cell = afs_use_cell(ctx->cell->alias_of, in afs_validate_fc()
397 afs_unuse_cell(ctx->cell, afs_cell_trace_unuse_fc); in afs_validate_fc()
398 ctx->cell = cell; in afs_validate_fc()
407 ctx->volume = volume; in afs_validate_fc()
408 if (volume->type != AFSVL_RWVOL) { in afs_validate_fc()
409 ctx->flock_mode = afs_flock_mode_local; in afs_validate_fc()
410 fc->sb_flags |= SB_RDONLY; in afs_validate_fc()
422 struct afs_fs_context *ctx = fc->fs_private; in afs_test_super()
425 return (as->net_ns == fc->net_ns && in afs_test_super()
426 as->volume && in afs_test_super()
427 as->volume->vid == ctx->volume->vid && in afs_test_super()
428 as->cell == ctx->cell && in afs_test_super()
429 !as->dyn_root); in afs_test_super()
436 return (as->net_ns == fc->net_ns && in afs_dynroot_test_super()
437 as->dyn_root); in afs_dynroot_test_super()
457 sb->s_blocksize = PAGE_SIZE; in afs_fill_super()
458 sb->s_blocksize_bits = PAGE_SHIFT; in afs_fill_super()
459 sb->s_maxbytes = MAX_LFS_FILESIZE; in afs_fill_super()
460 sb->s_magic = AFS_FS_MAGIC; in afs_fill_super()
461 sb->s_op = &afs_super_ops; in afs_fill_super()
462 if (!as->dyn_root) in afs_fill_super()
463 sb->s_xattr = afs_xattr_handlers; in afs_fill_super()
469 if (as->dyn_root) { in afs_fill_super()
472 sprintf(sb->s_id, "%llu", as->volume->vid); in afs_fill_super()
473 afs_activate_volume(as->volume); in afs_fill_super()
474 inode = afs_root_iget(sb, ctx->key); in afs_fill_super()
480 ret = -ENOMEM; in afs_fill_super()
481 sb->s_root = d_make_root(inode); in afs_fill_super()
482 if (!sb->s_root) in afs_fill_super()
485 if (as->dyn_root) { in afs_fill_super()
486 sb->s_d_op = &afs_dynroot_dentry_operations; in afs_fill_super()
488 sb->s_d_op = &afs_fs_dentry_operations; in afs_fill_super()
489 rcu_assign_pointer(as->volume->sb, sb); in afs_fill_super()
502 struct afs_fs_context *ctx = fc->fs_private; in afs_alloc_sbi()
507 as->net_ns = get_net(fc->net_ns); in afs_alloc_sbi()
508 as->flock_mode = ctx->flock_mode; in afs_alloc_sbi()
509 if (ctx->dyn_root) { in afs_alloc_sbi()
510 as->dyn_root = true; in afs_alloc_sbi()
512 as->cell = afs_use_cell(ctx->cell, afs_cell_trace_use_sbi); in afs_alloc_sbi()
513 as->volume = afs_get_volume(ctx->volume, in afs_alloc_sbi()
523 afs_put_volume(as->volume, afs_volume_trace_put_destroy_sbi); in afs_destroy_sbi()
524 afs_unuse_cell(as->cell, afs_cell_trace_unuse_sbi); in afs_destroy_sbi()
525 put_net(as->net_ns); in afs_destroy_sbi()
537 if (as->volume) in afs_kill_super()
538 rcu_assign_pointer(as->volume->sb, NULL); in afs_kill_super()
540 if (as->volume) in afs_kill_super()
541 afs_deactivate_volume(as->volume); in afs_kill_super()
550 struct afs_fs_context *ctx = fc->fs_private; in afs_get_tree()
562 ret = -ENOMEM; in afs_get_tree()
566 fc->s_fs_info = as; in afs_get_tree()
570 as->dyn_root ? afs_dynroot_test_super : afs_test_super, in afs_get_tree()
577 if (!sb->s_root) { in afs_get_tree()
583 sb->s_flags |= SB_ACTIVE; in afs_get_tree()
586 ASSERTCMP(sb->s_flags, &, SB_ACTIVE); in afs_get_tree()
589 fc->root = dget(sb->s_root); in afs_get_tree()
590 trace_afs_get_tree(as->cell, as->volume); in afs_get_tree()
603 struct afs_fs_context *ctx = fc->fs_private; in afs_free_fc()
605 afs_destroy_sbi(fc->s_fs_info); in afs_free_fc()
606 afs_put_volume(ctx->volume, afs_volume_trace_put_free_fc); in afs_free_fc()
607 afs_unuse_cell(ctx->cell, afs_cell_trace_unuse_fc); in afs_free_fc()
608 key_put(ctx->key); in afs_free_fc()
624 struct afs_cell *cell; in afs_init_fs_context() local
628 return -ENOMEM; in afs_init_fs_context()
630 ctx->type = AFSVL_ROVOL; in afs_init_fs_context()
631 ctx->net = afs_net(fc->net_ns); in afs_init_fs_context()
633 /* Default to the workstation cell. */ in afs_init_fs_context()
634 cell = afs_find_cell(ctx->net, NULL, 0, afs_cell_trace_use_fc); in afs_init_fs_context()
635 if (IS_ERR(cell)) in afs_init_fs_context()
636 cell = NULL; in afs_init_fs_context()
637 ctx->cell = cell; in afs_init_fs_context()
639 fc->fs_private = ctx; in afs_init_fs_context()
640 fc->ops = &afs_context_ops; in afs_init_fs_context()
654 inode_init_once(&vnode->netfs.inode); in afs_i_init_once()
655 INIT_LIST_HEAD(&vnode->io_lock_waiters); in afs_i_init_once()
656 init_rwsem(&vnode->validate_lock); in afs_i_init_once()
657 spin_lock_init(&vnode->wb_lock); in afs_i_init_once()
658 spin_lock_init(&vnode->lock); in afs_i_init_once()
659 INIT_LIST_HEAD(&vnode->wb_keys); in afs_i_init_once()
660 INIT_LIST_HEAD(&vnode->pending_locks); in afs_i_init_once()
661 INIT_LIST_HEAD(&vnode->granted_locks); in afs_i_init_once()
662 INIT_DELAYED_WORK(&vnode->lock_work, afs_lock_work); in afs_i_init_once()
663 INIT_LIST_HEAD(&vnode->cb_mmap_link); in afs_i_init_once()
664 seqlock_init(&vnode->cb_lock); in afs_i_init_once()
681 memset(&vnode->fid, 0, sizeof(vnode->fid)); in afs_alloc_inode()
682 memset(&vnode->status, 0, sizeof(vnode->status)); in afs_alloc_inode()
685 vnode->volume = NULL; in afs_alloc_inode()
686 vnode->lock_key = NULL; in afs_alloc_inode()
687 vnode->permit_cache = NULL; in afs_alloc_inode()
688 vnode->directory = NULL; in afs_alloc_inode()
689 vnode->directory_size = 0; in afs_alloc_inode()
691 vnode->flags = 1 << AFS_VNODE_UNSET; in afs_alloc_inode()
692 vnode->lock_state = AFS_VNODE_LOCK_NONE; in afs_alloc_inode()
694 init_rwsem(&vnode->rmdir_lock); in afs_alloc_inode()
695 INIT_WORK(&vnode->cb_work, afs_invalidate_mmap_work); in afs_alloc_inode()
697 _leave(" = %p", &vnode->netfs.inode); in afs_alloc_inode()
698 return &vnode->netfs.inode; in afs_alloc_inode()
713 _enter("%p{%llx:%llu}", inode, vnode->fid.vid, vnode->fid.vnode); in afs_destroy_inode()
722 struct afs_volume_status *vs = &op->volstatus.vs; in afs_get_volume_status_success()
723 struct kstatfs *buf = op->volstatus.buf; in afs_get_volume_status_success()
725 if (vs->max_quota == 0) in afs_get_volume_status_success()
726 buf->f_blocks = vs->part_max_blocks; in afs_get_volume_status_success()
728 buf->f_blocks = vs->max_quota; in afs_get_volume_status_success()
730 if (buf->f_blocks > vs->blocks_in_use) in afs_get_volume_status_success()
731 buf->f_bavail = buf->f_bfree = in afs_get_volume_status_success()
732 buf->f_blocks - vs->blocks_in_use; in afs_get_volume_status_success()
746 struct afs_super_info *as = AFS_FS_S(dentry->d_sb); in afs_statfs()
750 buf->f_type = dentry->d_sb->s_magic; in afs_statfs()
751 buf->f_bsize = AFS_BLOCK_SIZE; in afs_statfs()
752 buf->f_namelen = AFSNAMEMAX - 1; in afs_statfs()
754 if (as->dyn_root) { in afs_statfs()
755 buf->f_blocks = 1; in afs_statfs()
756 buf->f_bavail = 0; in afs_statfs()
757 buf->f_bfree = 0; in afs_statfs()
761 op = afs_alloc_operation(NULL, as->volume); in afs_statfs()
766 op->nr_files = 1; in afs_statfs()
767 op->volstatus.buf = buf; in afs_statfs()
768 op->ops = &afs_get_volume_status_operation; in afs_statfs()