]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: specify file max size in mdsmap
authorSage Weil <sage@newdream.net>
Thu, 16 Jul 2009 18:09:54 +0000 (11:09 -0700)
committerSage Weil <sage@newdream.net>
Thu, 16 Jul 2009 18:09:54 +0000 (11:09 -0700)
src/TODO
src/config.cc
src/config.h
src/include/ceph_fs.h
src/kernel/addr.c
src/kernel/inode.c
src/kernel/mds_client.c
src/kernel/mdsmap.c
src/kernel/mdsmap.h
src/kernel/super.c
src/mds/MDSMap.h

index c8510f68852eb748948d4ef6254f9722cfdc990c..0c3544ab55928e8454270842b953f4440bf1268e 100644 (file)
--- a/src/TODO
+++ b/src/TODO
@@ -31,8 +31,15 @@ v0.10
 /- improved monitor read model
 - osd bugfixes
 
+kclient review
+- andi
+  - server-specified max file size
+  - pr_debug
+  - top of file comments
+
 bugs
 - premature filejournal trimming?
+- mount.ceph doesn't update /etc/mtab
 
 later
 - authentication
index 3f25e591cc377a501d202b4d749a350c000c6554..6b3cd804f18d93f9a54af0d4a863fce733660cc6 100644 (file)
@@ -392,6 +392,7 @@ static struct config_option config_optionsp[] = {
        OPTION(journaler_prefetch_periods, 0, OPT_INT, 50),   // * journal object size (1~MB? see above)
        OPTION(journaler_batch_interval, 0, OPT_DOUBLE, .001),   // seconds.. max add'l latency we artificially incur
        OPTION(journaler_batch_max, 0, OPT_LONGLONG, 0),  // max bytes we'll delay flushing; disable, for now....
+       OPTION(mds_max_file_size, 0, OPT_LONGLONG, 1ULL << 40), 
        OPTION(mds_cache_size, 0, OPT_INT, 100000),
        OPTION(mds_cache_mid, 0, OPT_FLOAT, .7),
        OPTION(mds_mem_max, 0, OPT_INT, 1048576),        // KB
index 21fef8b4e0fa9b5c7278465a82ac65ae71667a69..3532dc8924c26890c66844d98a42a63107d71095 100644 (file)
@@ -180,6 +180,7 @@ struct md_config_t {
   long long unsigned journaler_batch_max;
   
   // mds
+  __u64 mds_max_file_size;
   int   mds_cache_size;
   float mds_cache_mid;
   int   mds_mem_max;
index 6dcd7f5141fc56a1b8b6768be4e9c096ed7db103..4ec1deeba94c975a869beb98150cfcca7d73e5dd 100644 (file)
 #include "msgr.h"
 #include "rados.h"
 
-/*
- * Max file size is a policy choice; in reality we are limited
- * by 2^64.
- */
-#define CEPH_FILE_MAX_SIZE (1ULL << 40)   /* 1 TB */
-
 /*
  * subprotocol versions.  when specific messages types or high-level
  * protocols change, bump the affected components.  we keep rev
@@ -26,9 +20,9 @@
 #define CEPH_OSD_PROTOCOL     6 /* cluster internal */
 #define CEPH_MDS_PROTOCOL     9 /* cluster internal */
 #define CEPH_MON_PROTOCOL     4 /* cluster internal */
-#define CEPH_OSDC_PROTOCOL   19 /* public/client */
-#define CEPH_MDSC_PROTOCOL   26 /* public/client */
-#define CEPH_MONC_PROTOCOL   14 /* public/client */
+#define CEPH_OSDC_PROTOCOL   19 /* server/client */
+#define CEPH_MDSC_PROTOCOL   27 /* server/client */
+#define CEPH_MONC_PROTOCOL   14 /* server/client */
 
 
 
index 61a0f4ec18e985c8d65a626fa40b85c5685a7377..d5e0b146a1f87a7d688a480e1c60bc14c496be9a 100644 (file)
@@ -960,7 +960,7 @@ retry_locked:
        /* past end of file? */
        i_size = inode->i_size;   /* caller holds i_mutex */
 
-       if (i_size + len > CEPH_FILE_MAX_SIZE) {
+       if (i_size + len > inode->i_sb->s_maxbytes) {
                /* file is too big */
                r = -EINVAL;
                goto fail;
index 3a937d29f5be7a9d31fbd47f2db6e973b7898a45..95f5cb9b83e8a2339e95e161640ffd41446c0c4a 100644 (file)
@@ -1277,7 +1277,7 @@ retry:
                spin_unlock(&inode->i_lock);
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
                filemap_write_and_wait_range(&inode->i_data, 0,
-                                            CEPH_FILE_MAX_SIZE);
+                                            inode->i_sb->s_maxbytes);
 #else
 # warning i may not flush all data after a snapshot + truncate.. i export need 2.6.30
                filemap_write_and_wait(&inode->i_data);
@@ -1443,7 +1443,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
        if (ia_valid & ATTR_SIZE) {
                dout(10, "setattr %p size %lld -> %lld\n", inode,
                     inode->i_size, attr->ia_size);
-               if (attr->ia_size > CEPH_FILE_MAX_SIZE) {
+               if (attr->ia_size > inode->i_sb->s_maxbytes) {
                        err = -EINVAL;
                        goto out;
                }
index c8df72d3f6c3992cd80d3002490e558a8c142313..4fb217b8df63bd38ae037cb59834845e1080b031 100644 (file)
@@ -2762,6 +2762,7 @@ void ceph_mdsc_handle_map(struct ceph_mds_client *mdsc, struct ceph_msg *msg)
        } else {
                mdsc->mdsmap = newmap;  /* first mds map */
        }
+       mdsc->client->sb->s_maxbytes = mdsc->mdsmap->m_max_file_size;
 
        __wake_requests(mdsc, &mdsc->waiting_for_map);
 
index b8fb0677d38945f646f1b30ce260429ec546ada3..cda76c7b933390ae44e1292c20dd83777ce69e4d 100644 (file)
@@ -57,13 +57,14 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
        if (m == NULL)
                return ERR_PTR(-ENOMEM);
 
-       ceph_decode_need(p, end, 8*sizeof(u32), bad);
+       ceph_decode_need(p, end, 8*sizeof(u32) + sizeof(u64), bad);
        ceph_decode_32(p, m->m_epoch);
        ceph_decode_32(p, m->m_client_epoch);
        ceph_decode_32(p, m->m_last_failure);
        ceph_decode_32(p, m->m_root);
        ceph_decode_32(p, m->m_session_timeout);
        ceph_decode_32(p, m->m_session_autoclose);
+       ceph_decode_64(p, m->m_max_file_size);
        ceph_decode_32(p, m->m_max_mds);
 
        m->m_addr = kzalloc(m->m_max_mds*sizeof(*m->m_addr), GFP_NOFS);
index 52389239f63b3dc3893ea0b6abbb0a16aa17bbf0..5560be5f972e49e16dd40cc7b759e091e13cb596 100644 (file)
@@ -13,6 +13,7 @@ struct ceph_mdsmap {
        u32 m_root;
        u32 m_session_timeout;          /* seconds */
        u32 m_session_autoclose;        /* seconds */
+       u64 m_max_file_size;
        u32 m_max_mds;                  /* size of m_addr, m_state arrays */
        struct ceph_entity_addr *m_addr;  /* mds addrs */
        s32 *m_state;                   /* states */
index c1fc6d9802667a1b4590fdd7944a72b3c204919d..b884e7ad207c2c5c8df9a319620faeba15badae7 100644 (file)
@@ -1005,7 +1005,7 @@ static int ceph_set_super(struct super_block *s, void *data)
        dout(10, "set_super %p data %p\n", s, data);
 
        s->s_flags = client->mount_args.sb_flags;
-       s->s_maxbytes = min((u64)MAX_LFS_FILESIZE, CEPH_FILE_MAX_SIZE);
+       s->s_maxbytes = 1ULL << 40;  /* temp value until we get mdsmap */
 
        s->s_fs_info = client;
        client->sb = s;
index f0388d4ace96276fda8680158af0236a501096d7..78d9eb7be47cd34376742bcdf2722d04090c080e 100644 (file)
@@ -131,6 +131,7 @@ protected:
 
   __u32 session_timeout;
   __u32 session_autoclose;
+  __u64 max_file_size;
 
   vector<__u32> data_pg_pools;  // file data pg_pools available to clients (via an ioctl).  first is the default.
   __u32 cas_pg_pool;            // where CAS objects go
@@ -161,6 +162,7 @@ public:
     // hack.. this doesn't really belong here
     session_timeout = (int)g_conf.mds_session_timeout;
     session_autoclose = (int)g_conf.mds_session_autoclose;
+    max_file_size = g_conf.mds_max_file_size;
   }
 
   utime_t get_session_timeout() {
@@ -373,6 +375,7 @@ public:
     ::encode(root, bl);
     ::encode(session_timeout, bl);
     ::encode(session_autoclose, bl);
+    ::encode(max_file_size, bl);
     ::encode(max_mds, bl);
     ::encode(mds_info, bl);
     ::encode(data_pg_pools, bl);
@@ -396,6 +399,7 @@ public:
     ::decode(root, p);
     ::decode(session_timeout, p);
     ::decode(session_autoclose, p);
+    ::decode(max_file_size, p);
     ::decode(max_mds, p);
     ::decode(mds_info, p);
     ::decode(data_pg_pools, p);