]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: sillywrite mount option
authorSage Weil <sage@newdream.net>
Sat, 29 Mar 2008 17:38:42 +0000 (10:38 -0700)
committerSage Weil <sage@newdream.net>
Sat, 29 Mar 2008 17:38:42 +0000 (10:38 -0700)
src/kernel/client.c
src/kernel/file.c
src/kernel/super.c
src/kernel/super.h

index 7bcbda3cbf4de51ea33a92e57b88d95cbdb98c53..f149d6c0e9b2fd627823fb8511330d203fd10db0 100644 (file)
@@ -6,9 +6,6 @@
 #include <linux/fs.h>
 #include <linux/mount.h>
 
-/* debug level; defined in super.h */
-int ceph_debug = 0;
-
 int ceph_client_debug = 50;
 #define DOUT_VAR ceph_client_debug
 #define DOUT_PREFIX "client: "
index 16d421f57eae260f39a0685c26754a79b70b35cc..97a65c59d91f231840731a5fbb06964bf6ef167a 100644 (file)
@@ -11,6 +11,8 @@ int ceph_debug_file = 50;
 
 #include <linux/namei.h>
 
+static ssize_t ceph_silly_write(struct file *file, const char __user *data,
+                               size_t count, loff_t *offset);
 
 /*
  * if err==0, caller is responsible for a put_session on *psession
@@ -227,10 +229,12 @@ out:
 /*
  * ditto
  */
-ssize_t ceph_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos)
+ssize_t ceph_write(struct file *filp, const char __user *buf, 
+                  size_t len, loff_t *ppos)
 {
        struct inode *inode = filp->f_dentry->d_inode;
        struct ceph_inode_info *ci = ceph_inode(inode);
+       struct ceph_client *client = ceph_inode_to_client(inode);
        ssize_t ret;
        int got = 0;
 
@@ -243,8 +247,11 @@ ssize_t ceph_write(struct file *filp, const char __user *buf, size_t len, loff_t
                goto out;
        dout(10, "write got cap refs on %d\n", got);
 
+       if (client->mount_args.silly_write) 
+               ret = ceph_silly_write(filp, buf, len, ppos);
+       else
        //if (got & CEPH_CAP_RDCACHE) {
-       ret = do_sync_write(filp, buf, len, ppos);
+               ret = do_sync_write(filp, buf, len, ppos);
 
 out:
        dout(10, "write dropping cap refs on %d\n", got);
@@ -254,13 +261,12 @@ out:
 
 
 
-
 /*
  * totally naive write.  just to get things sort of working.
  * ugly hack!
  */
-ssize_t ceph_silly_write(struct file *file, const char __user *data,
-                        size_t count, loff_t *offset)
+static ssize_t ceph_silly_write(struct file *file, const char __user *data,
+                               size_t count, loff_t *offset)
 {
        struct inode *inode = file->f_dentry->d_inode;
        struct ceph_inode_info *ci = ceph_inode(inode);
index 43428778dc3f58ea1ccccbbdc583ac446c3437bd..110e3451da9ac898acdc6a18af0119a92de4fd83 100644 (file)
@@ -6,9 +6,13 @@
 #include <linux/string.h>
 #include <linux/version.h>
 
-int ceph_debug_super = 50;
+/* debug levels; defined in super.h */
+
+/* global value.  0 = quiet, -1 == use per-file levels */
+int ceph_debug = 0;
 
-int ceph_lookup_cache = 1;
+/* for this file */
+int ceph_debug_super = 50;
 
 #define DOUT_VAR ceph_debug_super
 #define DOUT_PREFIX "super: "
@@ -213,7 +217,8 @@ enum {
        Opt_debug_osdc,
        Opt_monport,
        Opt_port,
-       Opt_ip
+       Opt_ip,
+       Opt_sillywrite,
 };
 
 static match_table_t arg_tokens = {
@@ -226,7 +231,9 @@ static match_table_t arg_tokens = {
        {Opt_debug_osdc, "debug_osdc=%d"},
        {Opt_monport, "monport=%d"},
        {Opt_port, "port=%d"},
-       {Opt_ip, "ip=%s"}
+       {Opt_ip, "ip=%s"},
+       /* int args above, no arguments below */
+       {Opt_sillywrite, "sillywrite"},
 };
 
 /*
@@ -313,6 +320,11 @@ static int parse_mount_args(int flags, char *options, const char *dev_name,
                if (!*c)
                        continue;
                token = match_token(c, arg_tokens, argstr);
+               if (token == 0) {
+                       derr(0, "bad mount option at '%s'\n", c);
+                       return -EINVAL;
+                       
+               }
                if (token < Opt_ip) {
                        ret = match_int(&argstr[0], &intval);
                        if (ret < 0) {
@@ -363,9 +375,13 @@ static int parse_mount_args(int flags, char *options, const char *dev_name,
                        ceph_debug_osdc = intval;
                        break;
 
+                       /* misc */
+               case Opt_sillywrite:
+                       args->silly_write = 1;
+                       break;
+
                default:
-                       derr(1, "parse_mount_args bad token %d\n", token);
-                       continue;
+                       BUG_ON(token);
                }
        }
 
index 1a0d0f754c82a44df5d3dfa9e44a8c229bd12b6e..893850273316e6b3619656065feb467c3a05ebfa 100644 (file)
@@ -19,8 +19,6 @@ extern int ceph_debug_mdsc;
 extern int ceph_debug_osdc;
 extern int ceph_debug_addr;
 
-extern int ceph_lookup_cache;
-
 #define CEPH_DUMP_ERROR_ALWAYS
 
 #define dout(x, args...) do {                                          \
@@ -65,6 +63,7 @@ struct ceph_mount_args {
        int num_mon;
        struct ceph_entity_addr mon_addr[5];
        char path[100];
+       int silly_write;
 };