Lines Matching +full:1 +full:- +full:cell
104 ret = -ENOMEM; in afs_fs_init()
157 struct afs_super_info *as = AFS_FS_S(root->d_sb); in afs_show_devname()
158 struct afs_volume *volume = as->volume; in afs_show_devname()
159 struct afs_cell *cell = as->cell; in afs_show_devname() local
163 if (as->dyn_root) { in afs_show_devname()
168 switch (volume->type) { in afs_show_devname()
173 if (volume->type_force) in afs_show_devname()
182 seq_printf(m, "%c%s:%s%s", pref, cell->name, volume->name, suf); in afs_show_devname()
191 struct afs_super_info *as = AFS_FS_S(root->d_sb); in afs_show_options()
194 if (as->dyn_root) in afs_show_options()
196 if (test_bit(AFS_VNODE_AUTOCELL, &AFS_FS_I(d_inode(root))->flags)) in afs_show_options()
198 switch (as->flock_mode) { in afs_show_options()
212 * Parse the source name to get cell name, volume name, volume type and R/W
216 * "%[cell:]volume[.]" R/W volume
217 * "#[cell:]volume[.]" R/O or R/W volume (R/O parent),
219 * "%[cell:]volume.readonly" R/O volume
220 * "#[cell:]volume.readonly" R/O volume
221 * "%[cell:]volume.backup" Backup volume
222 * "#[cell:]volume.backup" Backup volume
226 struct afs_fs_context *ctx = fc->fs_private; in afs_parse_source()
227 struct afs_cell *cell; in afs_parse_source() local
228 const char *cellname, *suffix, *name = param->string; in afs_parse_source()
233 if (fc->source) in afs_parse_source()
238 return -EINVAL; in afs_parse_source()
241 if ((name[0] != '%' && name[0] != '#') || !name[1]) { in afs_parse_source()
244 ctx->no_cell = true; in afs_parse_source()
248 return -EINVAL; in afs_parse_source()
253 ctx->type = AFSVL_RWVOL; in afs_parse_source()
254 ctx->force = true; in afs_parse_source()
258 /* split the cell name out if there is one */ in afs_parse_source()
259 ctx->volname = strchr(name, ':'); in afs_parse_source()
260 if (ctx->volname) { in afs_parse_source()
262 cellnamesz = ctx->volname - name; in afs_parse_source()
263 ctx->volname++; in afs_parse_source()
265 ctx->volname = name; in afs_parse_source()
271 suffix = strrchr(ctx->volname, '.'); in afs_parse_source()
274 ctx->type = AFSVL_ROVOL; in afs_parse_source()
275 ctx->force = true; in afs_parse_source()
277 ctx->type = AFSVL_BACKVOL; in afs_parse_source()
278 ctx->force = true; in afs_parse_source()
279 } else if (suffix[1] == 0) { in afs_parse_source()
285 ctx->volnamesz = suffix ? in afs_parse_source()
286 suffix - ctx->volname : strlen(ctx->volname); in afs_parse_source()
288 _debug("cell %*.*s [%p]", in afs_parse_source()
289 cellnamesz, cellnamesz, cellname ?: "", ctx->cell); in afs_parse_source()
291 /* lookup the cell record */ in afs_parse_source()
293 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->net, 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->net, ctx->volume, in afs_validate_fc()
385 ctx->volume = NULL; in afs_validate_fc()
388 if (test_bit(AFS_CELL_FL_CHECK_ALIAS, &ctx->cell->flags)) { in afs_validate_fc()
389 ret = afs_cell_detect_alias(ctx->cell, key); in afs_validate_fc()
392 if (ret == 1) { in afs_validate_fc()
394 key_put(ctx->key); in afs_validate_fc()
395 ctx->key = NULL; in afs_validate_fc()
396 cell = afs_use_cell(ctx->cell->alias_of, in afs_validate_fc()
398 afs_unuse_cell(ctx->net, ctx->cell, afs_cell_trace_unuse_fc); in afs_validate_fc()
399 ctx->cell = cell; in afs_validate_fc()
408 ctx->volume = volume; in afs_validate_fc()
419 struct afs_fs_context *ctx = fc->fs_private; in afs_test_super()
422 return (as->net_ns == fc->net_ns && in afs_test_super()
423 as->volume && in afs_test_super()
424 as->volume->vid == ctx->volume->vid && in afs_test_super()
425 as->cell == ctx->cell && in afs_test_super()
426 !as->dyn_root); in afs_test_super()
433 return (as->net_ns == fc->net_ns && in afs_dynroot_test_super()
434 as->dyn_root); in afs_dynroot_test_super()
454 sb->s_blocksize = PAGE_SIZE; in afs_fill_super()
455 sb->s_blocksize_bits = PAGE_SHIFT; in afs_fill_super()
456 sb->s_maxbytes = MAX_LFS_FILESIZE; in afs_fill_super()
457 sb->s_magic = AFS_FS_MAGIC; in afs_fill_super()
458 sb->s_op = &afs_super_ops; in afs_fill_super()
459 if (!as->dyn_root) in afs_fill_super()
460 sb->s_xattr = afs_xattr_handlers; in afs_fill_super()
466 if (as->dyn_root) { in afs_fill_super()
469 sprintf(sb->s_id, "%llu", as->volume->vid); in afs_fill_super()
470 afs_activate_volume(as->volume); in afs_fill_super()
471 inode = afs_root_iget(sb, ctx->key); in afs_fill_super()
477 if (ctx->autocell || as->dyn_root) in afs_fill_super()
478 set_bit(AFS_VNODE_AUTOCELL, &AFS_FS_I(inode)->flags); 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()
491 sb->s_d_op = &afs_fs_dentry_operations; in afs_fill_super()
492 rcu_assign_pointer(as->volume->sb, sb); in afs_fill_super()
505 struct afs_fs_context *ctx = fc->fs_private; in afs_alloc_sbi()
510 as->net_ns = get_net(fc->net_ns); in afs_alloc_sbi()
511 as->flock_mode = ctx->flock_mode; in afs_alloc_sbi()
512 if (ctx->dyn_root) { in afs_alloc_sbi()
513 as->dyn_root = true; in afs_alloc_sbi()
515 as->cell = afs_use_cell(ctx->cell, afs_cell_trace_use_sbi); in afs_alloc_sbi()
516 as->volume = afs_get_volume(ctx->volume, in afs_alloc_sbi()
526 struct afs_net *net = afs_net(as->net_ns); in afs_destroy_sbi()
527 afs_put_volume(net, as->volume, afs_volume_trace_put_destroy_sbi); in afs_destroy_sbi()
528 afs_unuse_cell(net, as->cell, afs_cell_trace_unuse_sbi); in afs_destroy_sbi()
529 put_net(as->net_ns); in afs_destroy_sbi()
538 if (as->dyn_root) in afs_kill_super()
544 if (as->volume) in afs_kill_super()
545 rcu_assign_pointer(as->volume->sb, NULL); in afs_kill_super()
547 if (as->volume) in afs_kill_super()
548 afs_deactivate_volume(as->volume); in afs_kill_super()
557 struct afs_fs_context *ctx = fc->fs_private; in afs_get_tree()
569 ret = -ENOMEM; in afs_get_tree()
573 fc->s_fs_info = as; in afs_get_tree()
577 as->dyn_root ? afs_dynroot_test_super : afs_test_super, in afs_get_tree()
584 if (!sb->s_root) { in afs_get_tree()
590 sb->s_flags |= SB_ACTIVE; in afs_get_tree()
593 ASSERTCMP(sb->s_flags, &, SB_ACTIVE); in afs_get_tree()
596 fc->root = dget(sb->s_root); in afs_get_tree()
597 trace_afs_get_tree(as->cell, as->volume); in afs_get_tree()
610 struct afs_fs_context *ctx = fc->fs_private; in afs_free_fc()
612 afs_destroy_sbi(fc->s_fs_info); in afs_free_fc()
613 afs_put_volume(ctx->net, ctx->volume, afs_volume_trace_put_free_fc); in afs_free_fc()
614 afs_unuse_cell(ctx->net, ctx->cell, afs_cell_trace_unuse_fc); in afs_free_fc()
615 key_put(ctx->key); in afs_free_fc()
631 struct afs_cell *cell; in afs_init_fs_context() local
635 return -ENOMEM; in afs_init_fs_context()
637 ctx->type = AFSVL_ROVOL; in afs_init_fs_context()
638 ctx->net = afs_net(fc->net_ns); in afs_init_fs_context()
640 /* Default to the workstation cell. */ in afs_init_fs_context()
641 cell = afs_find_cell(ctx->net, NULL, 0, afs_cell_trace_use_fc); in afs_init_fs_context()
642 if (IS_ERR(cell)) in afs_init_fs_context()
643 cell = NULL; in afs_init_fs_context()
644 ctx->cell = cell; in afs_init_fs_context()
646 fc->fs_private = ctx; in afs_init_fs_context()
647 fc->ops = &afs_context_ops; in afs_init_fs_context()
661 inode_init_once(&vnode->vfs_inode); in afs_i_init_once()
662 mutex_init(&vnode->io_lock); in afs_i_init_once()
663 init_rwsem(&vnode->validate_lock); in afs_i_init_once()
664 spin_lock_init(&vnode->wb_lock); in afs_i_init_once()
665 spin_lock_init(&vnode->lock); in afs_i_init_once()
666 INIT_LIST_HEAD(&vnode->wb_keys); in afs_i_init_once()
667 INIT_LIST_HEAD(&vnode->pending_locks); in afs_i_init_once()
668 INIT_LIST_HEAD(&vnode->granted_locks); in afs_i_init_once()
669 INIT_DELAYED_WORK(&vnode->lock_work, afs_lock_work); in afs_i_init_once()
670 seqlock_init(&vnode->cb_lock); in afs_i_init_once()
687 memset(&vnode->fid, 0, sizeof(vnode->fid)); in afs_alloc_inode()
688 memset(&vnode->status, 0, sizeof(vnode->status)); in afs_alloc_inode()
690 vnode->volume = NULL; in afs_alloc_inode()
691 vnode->lock_key = NULL; in afs_alloc_inode()
692 vnode->permit_cache = NULL; in afs_alloc_inode()
694 vnode->cache = NULL; in afs_alloc_inode()
697 vnode->flags = 1 << AFS_VNODE_UNSET; in afs_alloc_inode()
698 vnode->lock_state = AFS_VNODE_LOCK_NONE; in afs_alloc_inode()
700 init_rwsem(&vnode->rmdir_lock); in afs_alloc_inode()
702 _leave(" = %p", &vnode->vfs_inode); in afs_alloc_inode()
703 return &vnode->vfs_inode; in afs_alloc_inode()
718 _enter("%p{%llx:%llu}", inode, vnode->fid.vid, vnode->fid.vnode); in afs_destroy_inode()
727 struct afs_volume_status *vs = &op->volstatus.vs; in afs_get_volume_status_success()
728 struct kstatfs *buf = op->volstatus.buf; in afs_get_volume_status_success()
730 if (vs->max_quota == 0) in afs_get_volume_status_success()
731 buf->f_blocks = vs->part_max_blocks; in afs_get_volume_status_success()
733 buf->f_blocks = vs->max_quota; in afs_get_volume_status_success()
735 if (buf->f_blocks > vs->blocks_in_use) in afs_get_volume_status_success()
736 buf->f_bavail = buf->f_bfree = in afs_get_volume_status_success()
737 buf->f_blocks - vs->blocks_in_use; in afs_get_volume_status_success()
751 struct afs_super_info *as = AFS_FS_S(dentry->d_sb); in afs_statfs()
755 buf->f_type = dentry->d_sb->s_magic; in afs_statfs()
756 buf->f_bsize = AFS_BLOCK_SIZE; in afs_statfs()
757 buf->f_namelen = AFSNAMEMAX - 1; in afs_statfs()
759 if (as->dyn_root) { in afs_statfs()
760 buf->f_blocks = 1; in afs_statfs()
761 buf->f_bavail = 0; in afs_statfs()
762 buf->f_bfree = 0; in afs_statfs()
766 op = afs_alloc_operation(NULL, as->volume); in afs_statfs()
771 op->nr_files = 1; in afs_statfs()
772 op->volstatus.buf = buf; in afs_statfs()
773 op->ops = &afs_get_volume_status_operation; in afs_statfs()