]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
orangefs: Allow dcache and getattr cache time to be configured.
authorMartin Brandenburg <martin@omnibond.com>
Mon, 25 Jul 2016 17:58:24 +0000 (13:58 -0400)
committerMartin Brandenburg <martin@omnibond.com>
Tue, 2 Aug 2016 19:38:46 +0000 (15:38 -0400)
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
fs/orangefs/dcache.c
fs/orangefs/namei.c
fs/orangefs/orangefs-kernel.h
fs/orangefs/orangefs-mod.c
fs/orangefs/orangefs-sysfs.c
fs/orangefs/orangefs-utils.c

index dcb55bbb0b691b568f484f84454b11bc1201a3a9..2521af6707f72983f738ad7c374c1c6a6241eeb8 100644 (file)
@@ -73,7 +73,7 @@ static int orangefs_revalidate_lookup(struct dentry *dentry)
                }
        }
 
-       dentry->d_time = jiffies + HZ;
+       dentry->d_time = jiffies + dcache_timeout_msecs*HZ/1000;
        ret = 1;
 out_release_op:
        op_release(new_op);
index dde6c36f5a69073b09b27c442e543e3878bcc4b3..77071b78816a4149ee2efdc5e42754e1cb206c70 100644 (file)
@@ -72,7 +72,7 @@ static int orangefs_create(struct inode *dir,
 
        d_instantiate(dentry, inode);
        unlock_new_inode(inode);
-       dentry->d_time = jiffies + HZ;
+       dentry->d_time = jiffies + dcache_timeout_msecs*HZ/1000;
        ORANGEFS_I(inode)->getattr_time = 0;
 
        gossip_debug(GOSSIP_NAME_DEBUG,
@@ -183,7 +183,7 @@ static struct dentry *orangefs_lookup(struct inode *dir, struct dentry *dentry,
                goto out;
        }
 
-       dentry->d_time = jiffies + HZ;
+       dentry->d_time = jiffies + dcache_timeout_msecs*HZ/1000;
 
        inode = orangefs_iget(dir->i_sb, &new_op->downcall.resp.lookup.refn);
        if (IS_ERR(inode)) {
@@ -322,7 +322,7 @@ static int orangefs_symlink(struct inode *dir,
 
        d_instantiate(dentry, inode);
        unlock_new_inode(inode);
-       dentry->d_time = jiffies + HZ;
+       dentry->d_time = jiffies + dcache_timeout_msecs*HZ/1000;
        ORANGEFS_I(inode)->getattr_time = 0;
 
        gossip_debug(GOSSIP_NAME_DEBUG,
@@ -386,7 +386,7 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
 
        d_instantiate(dentry, inode);
        unlock_new_inode(inode);
-       dentry->d_time = jiffies + HZ;
+       dentry->d_time = jiffies + dcache_timeout_msecs*HZ/1000;
        ORANGEFS_I(inode)->getattr_time = 0;
 
        gossip_debug(GOSSIP_NAME_DEBUG,
index 9338fe64820d29f10f5eb793954e9cf3b4823952..633c07a6e3d80530b585c957edc6d5eeae70d042 100644 (file)
@@ -548,6 +548,8 @@ extern struct mutex request_mutex;
 extern int debug;
 extern int op_timeout_secs;
 extern int slot_timeout_secs;
+extern int dcache_timeout_msecs;
+extern int getattr_timeout_msecs;
 extern struct list_head orangefs_superblocks;
 extern spinlock_t orangefs_superblocks_lock;
 extern struct list_head orangefs_request_list;
index 6f072a8c0de1732f6c7823fd5b37f81f64156bc4..1caef0aab63e726a453819a223517e5e59d4aba1 100644 (file)
@@ -47,6 +47,8 @@ struct client_debug_mask client_debug_mask = { NULL, 0, 0 };
 unsigned int kernel_mask_set_mod_init; /* implicitly false */
 int op_timeout_secs = ORANGEFS_DEFAULT_OP_TIMEOUT_SECS;
 int slot_timeout_secs = ORANGEFS_DEFAULT_SLOT_TIMEOUT_SECS;
+int dcache_timeout_msecs = 1000;
+int getattr_timeout_msecs = 1000;
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("ORANGEFS Development Team");
index 5c03113e3ad2a791dcc757bcda2c4e8cf824e873..375708c2db87c728eacde70d6a0aba1458610e32 100644 (file)
  *                     Slots are requested and waited for,
  *                     the wait times out after slot_timeout_secs.
  *
+ * What:               /sys/fs/orangefs/dcache_timeout_msecs
+ * Date:               Jul 2016
+ * Contact:            Martin Brandenburg <martin@omnibond.com>
+ * Description:
+ *                     Time lookup is valid in milliseconds.
+ *
+ * What:               /sys/fs/orangefs/getattr_timeout_msecs
+ * Date:               Jul 2016
+ * Contact:            Martin Brandenburg <martin@omnibond.com>
+ * Description:
+ *                     Time getattr is valid in milliseconds.
  *
  * What:               /sys/fs/orangefs/acache/...
  * Date:               Jun 2015
- * Contact:            Mike Marshall <hubcap@omnibond.com>
+ * Contact:            Martin Brandenburg <martin@omnibond.com>
  * Description:
  *                     Attribute cache configurable settings.
  *
@@ -117,6 +128,8 @@ struct orangefs_obj {
        int perf_history_size;
        int perf_time_interval_secs;
        int slot_timeout_secs;
+       int dcache_timeout_msecs;
+       int getattr_timeout_msecs;
 };
 
 struct acache_orangefs_obj {
@@ -658,6 +671,20 @@ static ssize_t sysfs_int_show(char *kobj_id, char *buf, void *attr)
                                       "%d\n",
                                       slot_timeout_secs);
                        goto out;
+               } else if (!strcmp(orangefs_attr->attr.name,
+                                  "dcache_timeout_msecs")) {
+                       rc = scnprintf(buf,
+                                      PAGE_SIZE,
+                                      "%d\n",
+                                      dcache_timeout_msecs);
+                       goto out;
+               } else if (!strcmp(orangefs_attr->attr.name,
+                                  "getattr_timeout_msecs")) {
+                       rc = scnprintf(buf,
+                                      PAGE_SIZE,
+                                      "%d\n",
+                                      getattr_timeout_msecs);
+                       goto out;
                } else {
                        goto out;
                }
@@ -734,6 +761,12 @@ static ssize_t int_store(struct orangefs_obj *orangefs_obj,
        } else if (!strcmp(attr->attr.name, "slot_timeout_secs")) {
                rc = kstrtoint(buf, 0, &slot_timeout_secs);
                goto out;
+       } else if (!strcmp(attr->attr.name, "dcache_timeout_msecs")) {
+               rc = kstrtoint(buf, 0, &dcache_timeout_msecs);
+               goto out;
+       } else if (!strcmp(attr->attr.name, "getattr_timeout_msecs")) {
+               rc = kstrtoint(buf, 0, &getattr_timeout_msecs);
+               goto out;
        } else {
                goto out;
        }
@@ -1361,6 +1394,12 @@ static struct orangefs_attribute op_timeout_secs_attribute =
 static struct orangefs_attribute slot_timeout_secs_attribute =
        __ATTR(slot_timeout_secs, 0664, int_orangefs_show, int_store);
 
+static struct orangefs_attribute dcache_timeout_msecs_attribute =
+       __ATTR(dcache_timeout_msecs, 0664, int_orangefs_show, int_store);
+
+static struct orangefs_attribute getattr_timeout_msecs_attribute =
+       __ATTR(getattr_timeout_msecs, 0664, int_orangefs_show, int_store);
+
 static struct orangefs_attribute perf_counter_reset_attribute =
        __ATTR(perf_counter_reset,
               0664,
@@ -1382,6 +1421,8 @@ static struct orangefs_attribute perf_time_interval_secs_attribute =
 static struct attribute *orangefs_default_attrs[] = {
        &op_timeout_secs_attribute.attr,
        &slot_timeout_secs_attribute.attr,
+       &dcache_timeout_msecs_attribute.attr,
+       &getattr_timeout_msecs_attribute.attr,
        &perf_counter_reset_attribute.attr,
        &perf_history_size_attribute.attr,
        &perf_time_interval_secs_attribute.attr,
index 69b4d8af8d81841b7cc54dcdf265b32477b3e10c..cd512a3a9c528f0ccf13e811113408a3611ac721 100644 (file)
@@ -347,7 +347,7 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass)
        inode->i_mode = type | (is_root_handle(inode) ? S_ISVTX : 0) |
            orangefs_inode_perms(&new_op->downcall.resp.getattr.attributes);
 
-       orangefs_inode->getattr_time = jiffies + HZ;
+       orangefs_inode->getattr_time = jiffies + getattr_timeout_msecs*HZ/1000;
        ret = 0;
 out:
        op_release(new_op);