Whamcloud - gitweb
LU-5549 mdc: cl_default_mds_easize not refreshed
[fs/lustre-release.git] / lustre / llite / llite_lib.c
index 889e857..7d332ab 100644 (file)
@@ -653,6 +653,17 @@ int ll_get_max_mdsize(struct ll_sb_info *sbi, int *lmmsize)
        RETURN(rc);
 }
 
+/**
+ * Get the value of the default_easize parameter.
+ *
+ * \see client_obd::cl_default_mds_easize
+ *
+ * \param[in] sbi      superblock info for this filesystem
+ * \param[out] lmmsize pointer to storage location for value
+ *
+ * \retval 0           on success
+ * \retval negative    negated errno on failure
+ */
 int ll_get_default_mdsize(struct ll_sb_info *sbi, int *lmmsize)
 {
        int size, rc;
@@ -666,6 +677,32 @@ int ll_get_default_mdsize(struct ll_sb_info *sbi, int *lmmsize)
        RETURN(rc);
 }
 
+/**
+ * Set the default_easize parameter to the given value.
+ *
+ * \see client_obd::cl_default_mds_easize
+ *
+ * \param[in] sbi      superblock info for this filesystem
+ * \param[in] lmmsize  the size to set
+ *
+ * \retval 0           on success
+ * \retval negative    negated errno on failure
+ */
+int ll_set_default_mdsize(struct ll_sb_info *sbi, int lmmsize)
+{
+       int rc;
+
+       if (lmmsize < sizeof(struct lov_mds_md) ||
+           lmmsize > OBD_MAX_DEFAULT_EA_SIZE)
+               return -EINVAL;
+
+       rc = obd_set_info_async(NULL, sbi->ll_md_exp,
+                               sizeof(KEY_DEFAULT_EASIZE), KEY_DEFAULT_EASIZE,
+                               sizeof(int), &lmmsize, NULL);
+
+       RETURN(rc);
+}
+
 int ll_get_max_cookiesize(struct ll_sb_info *sbi, int *lmmsize)
 {
        int size, rc;
@@ -971,6 +1008,7 @@ void ll_lli_init(struct ll_inode_info *lli)
                spin_lock_init(&lli->lli_sa_lock);
                lli->lli_opendir_pid = 0;
                lli->lli_sa_enabled = 0;
+               lli->lli_def_stripe_offset = -1;
        } else {
                mutex_init(&lli->lli_size_mutex);
                lli->lli_symlink_name = NULL;
@@ -2531,8 +2569,12 @@ struct md_op_data * ll_prep_md_op_data(struct md_op_data *op_data,
        ll_i2gids(op_data->op_suppgids, i1, i2);
        op_data->op_fid1 = *ll_inode2fid(i1);
        op_data->op_capa1 = ll_mdscapa_get(i1);
-       if (S_ISDIR(i1->i_mode))
+       op_data->op_default_stripe_offset = -1;
+       if (S_ISDIR(i1->i_mode)) {
                op_data->op_mea1 = ll_i2info(i1)->lli_lsm_md;
+               op_data->op_default_stripe_offset =
+                          ll_i2info(i1)->lli_def_stripe_offset;
+       }
 
        if (i2) {
                op_data->op_fid2 = *ll_inode2fid(i2);