* we define this to be 2T - 4k, which is the ext3 maxbytes. */
#define LUSTRE_STRIPE_MAXBYTES 0x1fffffff000ULL
+/* Special values for remove LOV EA from disk */
+#define LOVEA_DELETE_VALUES(size, count, offset) (size == 0 && count == 0 && \
+ offset == (typeof(offset))(-1))
+
/* #define POISON_BULK 0 */
/*
rc = fsfilt_get_md(obd, inode, md, *size, "lov");
if (rc == 0 && flags == MDS_GETATTR)
- rc = mds_get_default_md(obd, md, &lmm_size);
+ rc = mds_get_default_md(obd, md);
if (rc < 0) {
CERROR("Error %d reading eadata for ino %lu\n",
int mds_post_mds_lovconf(struct obd_device *obd);
int mds_notify(struct obd_device *obd, struct obd_device *watched,
enum obd_notify_event ev, void *data);
-int mds_get_default_md(struct obd_device *obd, struct lov_mds_md *lmm,
- int *lmmsize);
+int mds_get_default_md(struct obd_device *obd, struct lov_user_md *lmm);
int mds_convert_lov_ea(struct obd_device *obd, struct inode *inode,
struct lov_mds_md *lmm, int lmm_size,
__u64 connect_flags);
RETURN(rc);
}
-int mds_get_default_md(struct obd_device *obd, struct lov_mds_md *lmm,
- int *size)
+int mds_get_default_md(struct obd_device *obd, struct lov_user_md *lum)
{
struct lov_desc *ldesc;
+ int rc, size = sizeof(*ldesc);
ENTRY;
+ if (!lum)
+ RETURN(0);
+
ldesc = &obd->u.mds.mds_lov_desc;
LASSERT(ldesc != NULL);
- if (!lmm)
- RETURN(0);
+ rc = obd_get_info(obd->u.mds.mds_lov_exp, sizeof(KEY_LOVDESC),
+ KEY_LOVDESC, &size, ldesc, NULL);
+ if (rc)
+ RETURN(rc);
- lmm->lmm_magic = LOV_MAGIC_V1;
- lmm->lmm_object_gr = LOV_OBJECT_GROUP_DEFAULT;
- lmm->lmm_pattern = ldesc->ld_pattern;
- lmm->lmm_stripe_size = ldesc->ld_default_stripe_size;
- lmm->lmm_stripe_count = ldesc->ld_default_stripe_count;
- *size = sizeof(struct lov_mds_md);
+ lum->lmm_magic = LOV_MAGIC_V1;
+ lum->lmm_object_gr = LOV_OBJECT_GROUP_DEFAULT;
+ lum->lmm_pattern = ldesc->ld_pattern;
+ lum->lmm_stripe_size = ldesc->ld_default_stripe_size;
+ lum->lmm_stripe_count = ldesc->ld_default_stripe_count;
+ lum->lmm_stripe_offset = ldesc->ld_default_stripe_offset;
- RETURN(sizeof(struct lov_mds_md));
+ RETURN(sizeof(*lum));
}
/* Convert the on-disk LOV EA structre.
* (i.e. all default values specified) then delete default
* striping from dir. */
if (S_ISDIR(inode->i_mode) &&
- (lum->lmm_stripe_size == 0 &&
- lum->lmm_stripe_offset ==
- (typeof(lum->lmm_stripe_offset))(-1) &&
- lum->lmm_stripe_count == 0 &&
- le32_to_cpu(lum->lmm_magic) != LOV_USER_MAGIC_V3)){
+ LOVEA_DELETE_VALUES(lum->lmm_stripe_size,
+ lum->lmm_stripe_count,
+ lum->lmm_stripe_offset) &&
+ (le32_to_cpu(lum->lmm_magic) != LOV_USER_MAGIC_V3)) {
rc = fsfilt_set_md(obd, inode, handle, NULL, 0, "lov");
if (rc)
GOTO(cleanup, rc);
lovdesc->ld_default_stripe_count = 1;
lovdesc->ld_pattern = LOV_PATTERN_RAID0;
lovdesc->ld_default_stripe_size = 1024 * 1024;
- lovdesc->ld_default_stripe_offset = 0;
+ lovdesc->ld_default_stripe_offset = -1;
lovdesc->ld_qos_maxage = QOS_DEFAULT_MAXAGE;
sprintf((char*)lovdesc->ld_uuid.uuid, "%s_UUID", lovname);
/* can these be the same? */
}
run_test 27y "create files while OST0 is degraded and the rest inactive"
+test_27z() { # b=19102
+ local restore_size=`$GETSTRIPE -s $MOUNT`
+ local restore_count=`$GETSTRIPE -c $MOUNT`
+ local restore_offset=`$GETSTRIPE -o $MOUNT`
+ $SETSTRIPE -c 0 -o -1 -s 0 $MOUNT
+ local default_size=`$GETSTRIPE -s $MOUNT`
+ local default_count=`$GETSTRIPE -c $MOUNT`
+ local default_offset=`$GETSTRIPE -o $MOUNT`
+ local dsize=$((1024 * 1024))
+ [ $default_size -eq $dsize ] || error "stripe size $default_size != $dsize"
+ [ $default_count -eq 1 ] || error "stripe count $default_count != 1"
+ [ $default_offset -eq -1 ] || error "stripe offset $default_offset != -1"
+ $SETSTRIPE -c $restore_count -o $restore_offset -s $restore_size $MOUNT
+}
+run_test 27z "check filesystem-wide default LOV EA values"
+
# createtest also checks that device nodes are created and
# then visible correctly (#2091)
test_28() { # bug 2091
}
/* get the stripe offset */
if (stripe_off_arg != NULL) {
- st_offset = strtoul(stripe_off_arg, &end, 0);
+ st_offset = strtol(stripe_off_arg, &end, 0);
if (*end != '\0') {
fprintf(stderr, "error: %s: bad stripe offset '%s'\n",
argv[0], stripe_off_arg);
if (verbose & ~VERBOSE_OFFSET)
llapi_printf(LLAPI_MSG_NORMAL, "%sstripe_offset: ",
prefix);
- llapi_printf(LLAPI_MSG_NORMAL, "%u%c",
- lum->lmm_objects[0].l_ost_idx, nl);
+ if (is_dir)
+ llapi_printf(LLAPI_MSG_NORMAL, "%d%c",
+ lum->lmm_stripe_offset ==
+ (typeof(lum->lmm_stripe_offset))(-1) ? -1 :
+ lum->lmm_stripe_offset, nl);
+ else
+ llapi_printf(LLAPI_MSG_NORMAL, "%u%c",
+ lum->lmm_objects[0].l_ost_idx, nl);
}
if ((verbose & VERBOSE_POOL) && (pool_name != NULL)) {