]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: use a private bdi
authorYehuda Sadeh <yehuda@hq.newdream.net>
Mon, 6 Oct 2008 23:00:34 +0000 (16:00 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Mon, 6 Oct 2008 23:00:49 +0000 (16:00 -0700)
src/kernel/inode.c
src/kernel/super.c
src/kernel/super.h

index bf76c5e13c83f615f911f46368388af420b05eae..732c2ecfe4735c61c7d2878833efe34eba25d6dc 100644 (file)
@@ -374,6 +374,7 @@ int ceph_fill_inode(struct inode *inode,
        ci->i_old_atime = inode->i_atime;
 
        inode->i_mapping->a_ops = &ceph_aops;
+       inode->i_mapping->backing_dev_info = &ceph_client(inode->i_sb)->backing_dev_info;
 
 no_change:
        /* populate frag tree */
index f91a49e01fd76dd314ea4e46b93b40b56f9514f7..176374b7085f039832272b5d97a1388cf074bfc5 100644 (file)
@@ -374,6 +374,7 @@ enum {
        Opt_monport,
        Opt_port,
        Opt_wsize,
+       Opt_rsize,
        Opt_osdtimeout,
        Opt_mount_timeout,
        /* int args above */
@@ -401,6 +402,7 @@ static match_table_t arg_tokens = {
        {Opt_monport, "monport=%d"},
        {Opt_port, "port=%d"},
        {Opt_wsize, "wsize=%d"},
+       {Opt_rsize, "rsize=%d"},
        {Opt_osdtimeout, "osdtimeout=%d"},
        {Opt_mount_timeout, "mount_timeout=%d"},
        /* int args above */
@@ -596,6 +598,9 @@ static int parse_mount_args(int flags, char *options, const char *dev_name,
                case Opt_wsize:
                        args->wsize = intval;
                        break;
+               case Opt_rsize:
+                       args->rsize = intval;
+                       break;
                case Opt_osdtimeout:
                        args->osd_timeout = intval;
                        break;
@@ -964,6 +969,25 @@ static int ceph_compare_super(struct super_block *sb, void *data)
        return 1;
 }
 
+static int ceph_init_bdi(struct super_block *sb, struct ceph_client *client)
+{
+       int err;
+
+       if (client->mount_args.rsize)
+               client->backing_dev_info.ra_pages = (client->mount_args.rsize + PAGE_SIZE - 1) >> PAGE_SHIFT;
+
+       if (client->backing_dev_info.ra_pages < PAGE_CACHE_SIZE)
+               client->backing_dev_info.ra_pages = PAGE_CACHE_SIZE;
+
+       err = bdi_init(&client->backing_dev_info);
+
+       if (err < 0)
+               return err;
+
+       return bdi_register_dev(&client->backing_dev_info, sb->s_dev);
+
+}
+
 static int ceph_get_sb(struct file_system_type *fs_type,
                       int flags, const char *dev_name, void *data,
                       struct vfsmount *mnt)
@@ -995,6 +1019,7 @@ static int ceph_get_sb(struct file_system_type *fs_type,
                err = PTR_ERR(sb);
                goto out;
        }
+
        if (ceph_client(sb) != client) {
                ceph_destroy_client(client);
                client = ceph_client(sb);
@@ -1002,6 +1027,10 @@ static int ceph_get_sb(struct file_system_type *fs_type,
        } else
                dout(20, "get_sb using new client %p\n", client);
 
+       err = ceph_init_bdi(sb, client);
+       if (err < 0)
+               goto out_splat;
+
        err = ceph_mount(client, mnt, path);
        if (err < 0)
                goto out_splat;
@@ -1024,7 +1053,9 @@ static void ceph_kill_sb(struct super_block *s)
        struct ceph_client *client = ceph_sb_to_client(s);
        dout(1, "kill_sb %p\n", s);
        ceph_mdsc_pre_umount(&client->mdsc);
+       bdi_unregister(&client->backing_dev_info);
        kill_anon_super(s);    /* will call put_super after sb is r/o */
+       bdi_destroy(&client->backing_dev_info);
        ceph_destroy_client(client);
 }
 
index 139bd6f6689c52df5933ea19db2cb80681f49549..b5df58bd7816139f6982157d942b6f6082ae00f4 100644 (file)
@@ -7,6 +7,8 @@
 #include <linux/pagemap.h>
 #include <linux/exportfs.h>
 #include <linux/sysfs.h>
+#include <linux/sysfs.h>
+#include <linux/backing-dev.h>
 
 #include "ceph_debug.h"
 #include "ceph_fs.h"
@@ -114,6 +116,7 @@ struct ceph_mount_args {
        int num_mon;
        struct ceph_entity_addr mon_addr[MAX_MON_MOUNT_ADDR];
        int wsize;
+       int rsize;
        int osd_timeout;
        char *snapdir_name;
 };
@@ -157,6 +160,8 @@ struct ceph_client {
 
        struct kobject *client_kobj;
 
+       struct backing_dev_info backing_dev_info;
+
        /* lets ignore all this until later */
        spinlock_t sb_lock;
        int num_sb;      /* ref count (for each sb_info that points to me) */