static struct dentry *ceph_dir_lookup(struct inode *dir, struct dentry *dentry,
struct nameidata *nd)
{
- struct ceph_client *client = dir->i_sb->s_fs_info;
+ struct ceph_client *client = ceph_sb_to_client(dir->i_sb);
struct ceph_mds_client *mdsc = &client->mdsc;
char *path;
int pathlen;
static int ceph_dir_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
{
- struct ceph_client *client = dir->i_sb->s_fs_info;
+ struct ceph_client *client = ceph_sb_to_client(dir->i_sb);
struct ceph_mds_client *mdsc = &client->mdsc;
struct inode *inode = NULL;
struct ceph_msg *req;
static int ceph_dir_symlink(struct inode *dir, struct dentry *dentry, const char *dest)
{
- struct ceph_client *client = dir->i_sb->s_fs_info;
+ struct ceph_client *client = ceph_sb_to_client(dir->i_sb);
struct ceph_mds_client *mdsc = &client->mdsc;
struct inode *inode = NULL;
struct ceph_msg *req;
static int ceph_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode)
{
- struct ceph_client *client = dir->i_sb->s_fs_info;
+ struct ceph_client *client = ceph_sb_to_client(dir->i_sb);
struct ceph_mds_client *mdsc = &client->mdsc;
struct inode *inode = NULL;
struct ceph_msg *req;
static int ceph_dir_unlink(struct inode *dir, struct dentry *dentry)
{
- struct ceph_client *client = dir->i_sb->s_fs_info;
+ struct ceph_client *client = ceph_sb_to_client(dir->i_sb);
struct ceph_mds_client *mdsc = &client->mdsc;
struct inode *inode = dentry->d_inode;
struct ceph_msg *req;
static int ceph_dir_rename(struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry)
{
- struct ceph_client *client = old_dir->i_sb->s_fs_info;
+ struct ceph_client *client = ceph_sb_to_client(old_dir->i_sb);
struct ceph_mds_client *mdsc = &client->mdsc;
struct ceph_msg *req;
struct ceph_mds_reply_info rinfo;
int do_open_request(struct super_block *sb, struct dentry *dentry, int flags, int create_mode,
struct ceph_mds_session **psession, struct ceph_mds_reply_info *rinfo)
{
- struct ceph_client *client = sb->s_fs_info;
+ struct ceph_client *client = ceph_sb_to_client(sb);
struct ceph_mds_client *mdsc = &client->mdsc;
ceph_ino_t pathbase;
char *path;
int ceph_setattr(struct dentry *dentry, struct iattr *attr)
{
struct inode *inode = dentry->d_inode;
- struct ceph_client *client = inode->i_sb->s_fs_info;
+ struct ceph_client *client = ceph_sb_to_client(inode->i_sb);
struct ceph_mds_client *mdsc = &client->mdsc;
const unsigned int ia_valid = attr->ia_valid;
struct ceph_msg *req;
void ceph_mdsc_handle_filecaps(struct ceph_mds_client *mdsc, struct ceph_msg *msg)
{
struct super_block *sb = mdsc->client->sb;
- struct ceph_client *client = sb->s_fs_info;
+ struct ceph_client *client = ceph_sb_to_client(sb);
struct ceph_mds_session *session;
struct inode *inode;
struct ceph_mds_file_caps *h;
*/
static int ceph_show_options(struct seq_file *m, struct vfsmount *mnt)
{
- struct ceph_client *client = mnt->mnt_sb->s_fs_info;
+ struct ceph_client *client = ceph_sb_to_client(mnt->mnt_sb);
struct ceph_mount_args *args = &client->mount_args;
if (ceph_debug != 0)
static int ceph_compare_super(struct super_block *sb, void *data)
{
struct ceph_mount_args *args = (struct ceph_mount_args*)data;
- struct ceph_client *other = sb->s_fs_info;
+ struct ceph_client *other = ceph_sb_to_client(sb);
int i;
dout(10, "ceph_compare_super %p\n", sb);
err = PTR_ERR(sb);
goto out;
}
- client = sb->s_fs_info;
+ client = ceph_sb_to_client(sb);
if ((err = ceph_mount(client, &mount_args, &droot)) < 0)
goto out_splat;
static void ceph_kill_sb(struct super_block *s)
{
- struct ceph_client *client = s->s_fs_info;
+ struct ceph_client *client = ceph_sb_to_client(s);
dout(1, "kill_sb %p\n", s);
ceph_destroy_client(client);
kill_anon_super(s);
return (struct ceph_client*)inode->i_sb->s_fs_info;
}
+static inline struct ceph_client *ceph_sb_to_client(struct super_block *sb)
+{
+ return (struct ceph_client*)sb->s_fs_info;
+}
/*
* keep readdir buffers attached to file->private_data
*/