summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@hq.newdream.net>2008-10-07 01:00:34 +0200
committerYehuda Sadeh <yehuda@hq.newdream.net>2008-10-07 01:00:49 +0200
commitd0a822ed0031959a871b7bb3aa53fddbac137cf5 (patch)
tree33cbbc1ce4bfafe79c004d0403ed0a4132a86ba6
parentkclient: fix file to object mapping (diff)
downloadceph-d0a822ed0031959a871b7bb3aa53fddbac137cf5.tar.xz
ceph-d0a822ed0031959a871b7bb3aa53fddbac137cf5.zip
kclient: use a private bdi
-rw-r--r--src/kernel/inode.c1
-rw-r--r--src/kernel/super.c31
-rw-r--r--src/kernel/super.h5
3 files changed, 37 insertions, 0 deletions
diff --git a/src/kernel/inode.c b/src/kernel/inode.c
index bf76c5e13c8..732c2ecfe47 100644
--- a/src/kernel/inode.c
+++ b/src/kernel/inode.c
@@ -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 */
diff --git a/src/kernel/super.c b/src/kernel/super.c
index f91a49e01fd..176374b7085 100644
--- a/src/kernel/super.c
+++ b/src/kernel/super.c
@@ -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);
}
diff --git a/src/kernel/super.h b/src/kernel/super.h
index 139bd6f6689..b5df58bd781 100644
--- a/src/kernel/super.h
+++ b/src/kernel/super.h
@@ -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) */