#define FS_IOC_GOINGDOWN _IOR ('X', 125, __u32)
-static long bch_fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
+static long bch_fs_file_ioctl(struct file *filp, unsigned int cmd,
+ unsigned long arg)
{
struct inode *inode = file_inode(filp);
struct super_block *sb = inode->i_sb;
down_write(&sb->s_umount);
sb->s_flags |= MS_RDONLY;
- bch_cache_set_emergency_read_only(c);
+ bch_fs_emergency_read_only(c);
up_write(&sb->s_umount);
return 0;
default:
- return bch_cache_set_ioctl(c, cmd, (void __user *) arg);
+ return bch_fs_ioctl(c, cmd, (void __user *) arg);
}
}
default:
return -ENOIOCTLCMD;
}
- return bch_fs_ioctl(file, cmd, (unsigned long) compat_ptr(arg));
+ return bch_fs_file_ioctl(file, cmd, (unsigned long) compat_ptr(arg));
}
#endif
.splice_read = generic_file_splice_read,
.splice_write = iter_file_splice_write,
.fallocate = bch_fallocate_dispatch,
- .unlocked_ioctl = bch_fs_ioctl,
+ .unlocked_ioctl = bch_fs_file_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = bch_compat_fs_ioctl,
#endif
.read = generic_read_dir,
.iterate = bch_vfs_readdir,
.fsync = bch_fsync,
- .unlocked_ioctl = bch_fs_ioctl,
+ .unlocked_ioctl = bch_fs_file_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = bch_compat_fs_ioctl,
#endif
buf->f_type = BCACHE_STATFS_MAGIC;
buf->f_bsize = sb->s_blocksize;
buf->f_blocks = c->capacity >> PAGE_SECTOR_SHIFT;
- buf->f_bfree = (c->capacity - cache_set_sectors_used(c)) >> PAGE_SECTOR_SHIFT;
+ buf->f_bfree = (c->capacity - bch_fs_sectors_used(c)) >> PAGE_SECTOR_SHIFT;
buf->f_bavail = buf->f_bfree;
buf->f_files = atomic_long_read(&c->nr_inodes);
buf->f_ffree = U64_MAX;
rcu_read_lock();
- list_for_each_entry(c, &bch_cache_sets, list)
+ list_for_each_entry(c, &bch_fs_list, list)
for_each_cache_rcu(ca, c, i)
if (ca->disk_sb.bdev == bdev) {
rcu_read_unlock();
}
static struct cache_set *bch_open_as_blockdevs(const char *_dev_name,
- struct cache_set_opts opts)
+ struct bch_opts opts)
{
size_t nr_devs = 0, i = 0;
char *dev_name, *s, **devs;
(s = strchr(s, ':')) && (*s++ = '\0'))
devs[i++] = s;
- err = bch_register_cache_set(devs, nr_devs, opts, &c);
+ err = bch_fs_open(devs, nr_devs, opts, &c);
if (err) {
/*
* Already open?
if (!c)
goto err_unlock;
- if (!test_bit(CACHE_SET_RUNNING, &c->flags)) {
+ if (!test_bit(BCH_FS_RUNNING, &c->flags)) {
err = "incomplete cache set";
c = NULL;
goto err_unlock;
mutex_unlock(&bch_register_lock);
}
- set_bit(CACHE_SET_BDEV_MOUNTED, &c->flags);
+ set_bit(BCH_FS_BDEV_MOUNTED, &c->flags);
err:
kfree(devs);
kfree(dev_name);
static int bch_remount(struct super_block *sb, int *flags, char *data)
{
struct cache_set *c = sb->s_fs_info;
- struct cache_set_opts opts;
+ struct bch_opts opts = bch_opts_empty();
int ret;
- ret = bch_parse_options(&opts, *flags, data);
+ opts.read_only = (*flags & MS_RDONLY) != 0;
+
+ ret = bch_parse_mount_opts(&opts, data);
if (ret)
return ret;
const char *err = NULL;
if (opts.read_only) {
- bch_cache_set_read_only_sync(c);
+ bch_fs_read_only_sync(c);
sb->s_flags |= MS_RDONLY;
} else {
- err = bch_cache_set_read_write(c);
+ err = bch_fs_read_write(c);
if (err) {
bch_err(c, "error going rw: %s", err);
ret = -EINVAL;
struct cache *ca;
struct super_block *sb;
struct inode *inode;
- struct cache_set_opts opts;
+ struct bch_opts opts = bch_opts_empty();
unsigned i;
int ret;
- ret = bch_parse_options(&opts, flags, data);
+ opts.read_only = (flags & MS_RDONLY) != 0;
+
+ ret = bch_parse_mount_opts(&opts, data);
if (ret)
return ERR_PTR(ret);
generic_shutdown_super(sb);
- if (test_bit(CACHE_SET_BDEV_MOUNTED, &c->flags)) {
- DECLARE_COMPLETION_ONSTACK(complete);
-
- c->stop_completion = &complete;
- bch_cache_set_stop(c);
- closure_put(&c->cl);
-
- /* Killable? */
- wait_for_completion(&complete);
- } else
+ if (test_bit(BCH_FS_BDEV_MOUNTED, &c->flags))
+ bch_fs_stop_sync(c);
+ else
closure_put(&c->cl);
}