@@ -480,7 +480,7 @@ static int ll_dir_setdirstripe(struct dentry *dparent, struct lmv_user_md *lump,
if (IS_ERR(op_data))
return PTR_ERR(op_data);
- op_data->op_dir_depth = ll_i2info(parent)->lli_depth;
+ op_data->op_dir_depth = ll_i2info(parent)->lli_dir_depth;
if (ll_sbi_has_encrypt(sbi) &&
(IS_ENCRYPTED(parent) ||
@@ -184,7 +184,7 @@ struct ll_inode_info {
*/
pid_t lli_opendir_pid;
/* directory depth to ROOT */
- unsigned short lli_depth;
+ unsigned short lli_dir_depth;
/* stat will try to access statahead entries or start
* statahead if this flag is set, and this flag will be
* set upon dir open, and cleared when dir is closed,
@@ -2609,9 +2609,9 @@ void ll_update_dir_depth(struct inode *dir, struct inode *inode)
return;
lli = ll_i2info(inode);
- lli->lli_depth = ll_i2info(dir)->lli_depth + 1;
- CDEBUG(D_INODE, DFID" depth %hu\n", PFID(&lli->lli_fid),
- lli->lli_depth);
+ lli->lli_dir_depth = ll_i2info(dir)->lli_dir_depth + 1;
+ CDEBUG(D_INODE, DFID" depth %hu\n",
+ PFID(&lli->lli_fid), lli->lli_dir_depth);
}
void ll_truncate_inode_pages_final(struct inode *inode)
@@ -1493,7 +1493,7 @@ static void ll_qos_mkdir_prep(struct md_op_data *op_data, struct inode *dir)
struct ll_inode_info *lli = ll_i2info(dir);
struct lmv_stripe_md *lsm;
- op_data->op_dir_depth = lli->lli_depth;
+ op_data->op_dir_depth = lli->lli_dir_depth;
/* parent directory is striped */
if (unlikely(lli->lli_lsm_md))
@@ -1522,11 +1522,11 @@ static void ll_qos_mkdir_prep(struct md_op_data *op_data, struct inode *dir)
if (lsm->lsm_md_max_inherit != LMV_INHERIT_NONE &&
(lsm->lsm_md_max_inherit == LMV_INHERIT_UNLIMITED ||
- lsm->lsm_md_max_inherit >= lli->lli_depth)) {
+ lsm->lsm_md_max_inherit >= lli->lli_dir_depth)) {
op_data->op_flags |= MF_QOS_MKDIR;
if (lsm->lsm_md_max_inherit_rr != LMV_INHERIT_RR_NONE &&
(lsm->lsm_md_max_inherit_rr == LMV_INHERIT_RR_UNLIMITED ||
- lsm->lsm_md_max_inherit_rr >= lli->lli_depth))
+ lsm->lsm_md_max_inherit_rr >= lli->lli_dir_depth))
op_data->op_flags |= MF_RR_MKDIR;
CDEBUG(D_INODE, DFID" requests qos mkdir %#x\n",
PFID(&lli->lli_fid), op_data->op_flags);
@@ -1471,10 +1471,11 @@ static struct lu_tgt_desc *lmv_locate_tgt_qos(struct lmv_obd *lmv, u32 mdt,
/* if current MDT has above-average space, within range of the QOS
* threshold, stay on the same MDT to avoid creating needless remote
- * MDT directories. It's more likely for low level directories.
+ * MDT directories. It's more likely for low level directories
+ * "16 / (dir_depth + 10)" is the factor to make it more unlikely for
+ * top level directories, while more likely for low levels.
*/
- rand = total_avail * (256 - lmv->lmv_qos.lq_threshold_rr) /
- (total_usable * 256 * (1 + dir_depth / 4));
+ rand = total_avail * 16 / (total_usable * (dir_depth + 10));
if (cur && cur->ltd_qos.ltq_avail >= rand) {
tgt = cur;
goto unlock;