Skip to content
Snippets Groups Projects
Commit 0cdeb78b authored by Bobi Jam's avatar Bobi Jam
Browse files

Branch b1_6

b=14803
i=johann, adilger

Description: Don't update lov_desc members until making sure they are valid
Details    : When updating lov_desc members via proc fs, need fix their
             validities before doing the real update.
parent f6f51fb6
No related branches found
No related tags found
No related merge requests found
......@@ -25,11 +25,11 @@ tbd Sun Microsystems, Inc.
'tunefs.lustre --param="mdt.quota_type=ug1" $MDTDEV'.
For more information, please refer to bugzilla 13904.
Severity :
Bugzilla :
Frequency :
Description:
Details :
Severity : normal
Bugzilla : 14803
Description: Don't update lov_desc members until making sure they are valid
Details : When updating lov_desc members via proc fs, need fix their
validities before doing the real update.
-------------------------------------------------------------------------------
......
......@@ -224,6 +224,10 @@ int lov_fini_statfs_set(struct lov_request_set *set);
/* lov_obd.c */
void lov_fix_desc(struct lov_desc *desc);
void lov_fix_desc_stripe_size(__u64 *val);
void lov_fix_desc_stripe_count(__u32 *val);
void lov_fix_desc_pattern(__u32 *val);
void lov_fix_desc_qos_maxage(__u32 *val);
int lov_get_stripecnt(struct lov_obd *lov, __u32 stripe_count);
void lov_getref(struct obd_device *obd);
void lov_putref(struct obd_device *obd);
......
......@@ -768,31 +768,48 @@ static void __lov_del_obd(struct obd_device *obd, __u32 index)
}
}
void lov_fix_desc(struct lov_desc *desc)
void lov_fix_desc_stripe_size(__u64 *val)
{
if (desc->ld_default_stripe_size < PTLRPC_MAX_BRW_SIZE) {
if (*val < PTLRPC_MAX_BRW_SIZE) {
LCONSOLE_WARN("Increasing default stripe size to min %u\n",
PTLRPC_MAX_BRW_SIZE);
desc->ld_default_stripe_size = PTLRPC_MAX_BRW_SIZE;
} else if (desc->ld_default_stripe_size & (LOV_MIN_STRIPE_SIZE - 1)) {
desc->ld_default_stripe_size &= ~(LOV_MIN_STRIPE_SIZE - 1);
*val = PTLRPC_MAX_BRW_SIZE;
} else if (*val & (LOV_MIN_STRIPE_SIZE - 1)) {
*val &= ~(LOV_MIN_STRIPE_SIZE - 1);
LCONSOLE_WARN("Changing default stripe size to "LPU64" (a "
"multiple of %u)\n",
desc->ld_default_stripe_size,LOV_MIN_STRIPE_SIZE);
*val, LOV_MIN_STRIPE_SIZE);
}
}
if (desc->ld_default_stripe_count == 0)
desc->ld_default_stripe_count = 1;
void lov_fix_desc_stripe_count(__u32 *val)
{
if (*val == 0)
*val = 1;
}
void lov_fix_desc_pattern(__u32 *val)
{
/* from lov_setstripe */
if ((desc->ld_pattern != 0) &&
(desc->ld_pattern != LOV_PATTERN_RAID0)) {
LCONSOLE_WARN("Unknown stripe pattern: %#x\n",desc->ld_pattern);
desc->ld_pattern = 0;
if ((*val != 0) && (*val != LOV_PATTERN_RAID0)) {
LCONSOLE_WARN("Unknown stripe pattern: %#x\n", *val);
*val = 0;
}
}
void lov_fix_desc_qos_maxage(__u32 *val)
{
/* fix qos_maxage */
if (desc->ld_qos_maxage == 0)
desc->ld_qos_maxage = QOS_DEFAULT_MAXAGE;
if (*val == 0)
*val = QOS_DEFAULT_MAXAGE;
}
void lov_fix_desc(struct lov_desc *desc)
{
lov_fix_desc_stripe_size(&desc->ld_default_stripe_size);
lov_fix_desc_stripe_count(&desc->ld_default_stripe_count);
lov_fix_desc_pattern(&desc->ld_pattern);
lov_fix_desc_qos_maxage(&desc->ld_qos_maxage);
}
static int lov_setup(struct obd_device *obd, obd_count len, void *buf)
......
......@@ -60,8 +60,8 @@ static int lov_wr_stripesize(struct file *file, const char *buffer,
if (rc)
return rc;
lov_fix_desc_stripe_size(&val);
desc->ld_default_stripe_size = val;
lov_fix_desc(desc);
return count;
}
......@@ -92,7 +92,6 @@ static int lov_wr_stripeoffset(struct file *file, const char *buffer,
return rc;
desc->ld_default_stripe_offset = val;
lov_fix_desc(desc);
return count;
}
......@@ -121,8 +120,8 @@ static int lov_wr_stripetype(struct file *file, const char *buffer,
if (rc)
return rc;
lov_fix_desc_pattern(&val);
desc->ld_pattern = val;
lov_fix_desc(desc);
return count;
}
......@@ -152,8 +151,8 @@ static int lov_wr_stripecount(struct file *file, const char *buffer,
if (rc)
return rc;
lov_fix_desc_stripe_count(&val);
desc->ld_default_stripe_count = val;
lov_fix_desc(desc);
return count;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment