};
#define LMA_INCOMPAT_SUPP (LMAI_AGENT | LMAI_REMOTE_PARENT)
-/**
- * Following struct for MDT attributes, that will be kept inode's EA.
- * Introduced in 2.0 release (please see b15993, for details)
- */
-struct lustre_mdt_attrs {
- /**
- * Bitfield for supported data in this structure. From enum lma_compat.
- * lma_self_fid and lma_flags are always available.
- */
- __u32 lma_compat;
- /**
- * Per-file incompat feature list. Lustre version should support all
- * flags set in this field. The supported feature mask is available in
- * LMA_INCOMPAT_SUPP.
- */
- __u32 lma_incompat;
- /** FID of this inode */
- struct lu_fid lma_self_fid;
- /** mdt/ost type, others */
- __u64 lma_flags;
-};
-
-/**
- * Prior to 2.4, the LMA structure also included SOM attributes which has since
- * been moved to a dedicated xattr
- */
-#define LMA_OLD_SIZE (sizeof(struct lustre_mdt_attrs) + 4 * sizeof(__u64))
-
extern void lustre_lma_swab(struct lustre_mdt_attrs *lma);
extern void lustre_lma_init(struct lustre_mdt_attrs *lma,
const struct lu_fid *fid, __u32 incompat);
static inline int fid_seq_is_local_file(const __u64 seq)
{
- return seq == FID_SEQ_LOCAL_FILE;
+ return seq == FID_SEQ_LOCAL_FILE ||
+ seq == FID_SEQ_LOCAL_NAME;
};
static inline int fid_seq_is_root(const __u64 seq)
};
struct filter_fid {
- struct lu_fid ff_parent; /* ff_parent.f_ver == file stripe number */
- __u64 ff_objid;
- __u64 ff_seq;
+ struct lu_fid ff_parent; /* ff_parent.f_ver == file stripe number */
+};
+
+/* keep this one for compatibility */
+struct filter_fid_old {
+ struct lu_fid ff_parent;
+ __u64 ff_objid;
+ __u64 ff_seq;
};
/* Userspace should treat lu_fid as opaque, and only use the following methods
* here from lustre_idl.h if needed. */
typedef struct lu_fid lustre_fid;
+/**
+ * Following struct for object attributes, that will be kept inode's EA.
+ * Introduced in 2.0 release (please see b15993, for details)
+ * Added to all objects since Lustre 2.4 as contains self FID
+ */
+struct lustre_mdt_attrs {
+ /**
+ * Bitfield for supported data in this structure. From enum lma_compat.
+ * lma_self_fid and lma_flags are always available.
+ */
+ __u32 lma_compat;
+ /**
+ * Per-file incompat feature list. Lustre version should support all
+ * flags set in this field. The supported feature mask is available in
+ * LMA_INCOMPAT_SUPP.
+ */
+ __u32 lma_incompat;
+ /** FID of this inode */
+ struct lu_fid lma_self_fid;
+};
+
+/**
+ * Prior to 2.4, the LMA structure also included SOM attributes which has since
+ * been moved to a dedicated xattr
+ * lma_flags was also removed because of lma_compat/incompat fields.
+ */
+#define LMA_OLD_SIZE (sizeof(struct lustre_mdt_attrs) + 5 * sizeof(__u64))
+
/*
* The ioctl naming rules:
* LL_* - works on the currently opened filehandle instead of parent dir
lma->lma_compat = 0;
lma->lma_incompat = incompat;
lma->lma_self_fid = *fid;
- lma->lma_flags = 0;
/* If a field is added in struct lustre_mdt_attrs, zero it explicitly
* and change the test below. */
LASSERT(sizeof(*lma) ==
- (offsetof(struct lustre_mdt_attrs, lma_flags) +
- sizeof(lma->lma_flags)));
+ (offsetof(struct lustre_mdt_attrs, lma_self_fid) +
+ sizeof(lma->lma_self_fid)));
};
EXPORT_SYMBOL(lustre_lma_init);
__swab32s(&lma->lma_compat);
__swab32s(&lma->lma_incompat);
lustre_swab_lu_fid(&lma->lma_self_fid);
- __swab64s(&lma->lma_flags);
}
};
EXPORT_SYMBOL(lustre_lma_swab);
struct lu_attr fti_attr2;
struct ldlm_res_id fti_resid;
struct filter_fid fti_mds_fid;
- struct filter_fid fti_mds_fid2;
struct ost_id fti_ostid;
struct ofd_object *fti_obj;
union {
/* XXX: we are ignoring o_parent_ver here, since this should
* be the same for all objects in this fileset. */
ff->ff_parent.f_ver = cpu_to_le32(oa->o_stripe_idx);
- ff->ff_objid = cpu_to_le64(oa->o_id);
- ff->ff_seq = cpu_to_le64(oa->o_seq);
}
/* niobuf_remote has no rnb_ prefix in master */
int ofd_object_ff_check(const struct lu_env *env, struct ofd_object *fo)
{
- struct ofd_thread_info *info = ofd_info(env);
- int rc = 0;
+ int rc = 0;
ENTRY;
* This actually means that we don't know whether the object
* has the "fid" EA or not.
*/
- info->fti_buf.lb_buf = &info->fti_mds_fid2;
- info->fti_buf.lb_len = sizeof(info->fti_mds_fid2);
- rc = dt_xattr_get(env, ofd_object_child(fo), &info->fti_buf,
+ rc = dt_xattr_get(env, ofd_object_child(fo), &LU_BUF_NULL,
XATTR_NAME_FID, BYPASS_CAPA);
if (rc >= 0 || rc == -ENODATA) {
/*
osd_trans_declare_rb(env, th, OSD_OT_REF_ADD);
result = __osd_object_create(info, obj, attr, hint, dof, th);
-
- if (OBD_FAIL_CHECK(OBD_FAIL_FID_IGIF) && !fid_is_internal(fid))
- return result;
-
- if ((result == 0) &&
- (fid_is_last_id(fid) ||
- !fid_is_on_ost(info, osd_dt_dev(th->th_dev), fid)))
+ if (result == 0)
result = osd_ea_fid_set(info, obj->oo_inode, fid, 0);
- if (result == 0)
- result = __osd_oi_insert(env, obj, fid, th);
+ if (result == 0)
+ result = __osd_oi_insert(env, obj, fid, th);
LASSERT(ergo(result == 0,
dt_object_exists(dt) && !dt_object_remote(dt)));
int rc;
ENTRY;
- if (unlikely(fid_is_local_file(fid) || fid_is_igif(fid)))
+ if (unlikely(fid_is_local_file(fid) || fid_is_igif(fid) ||
+ fid_is_llog(fid)))
RETURN(0);
if (fid_is_idif(fid) || fid_is_last_id(fid))
{
/* Wire protocol assertions generated by 'wirecheck'
* (make -C lustre/utils newwiretest)
- * running on Linux testnode 2.6.32-279.5.1.el6_lustre.g53f705f.x86_64 #1 SMP Mon Oct 8 05:12
+ * running on Linux node7 2.6.32 #1 SMP Tue Dec 18 04:02:25 MSK 2012 x86_64 x86_64 x86_64 GNU
* with gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) */
(long long)LU_SEQ_RANGE_OST);
/* Checks for struct lustre_mdt_attrs */
- LASSERTF((int)sizeof(struct lustre_mdt_attrs) == 32, "found %lld\n",
+ LASSERTF((int)sizeof(struct lustre_mdt_attrs) == 24, "found %lld\n",
(long long)(int)sizeof(struct lustre_mdt_attrs));
LASSERTF((int)offsetof(struct lustre_mdt_attrs, lma_compat) == 0, "found %lld\n",
(long long)(int)offsetof(struct lustre_mdt_attrs, lma_compat));
(long long)(int)offsetof(struct lustre_mdt_attrs, lma_self_fid));
LASSERTF((int)sizeof(((struct lustre_mdt_attrs *)0)->lma_self_fid) == 16, "found %lld\n",
(long long)(int)sizeof(((struct lustre_mdt_attrs *)0)->lma_self_fid));
- LASSERTF((int)offsetof(struct lustre_mdt_attrs, lma_flags) == 24, "found %lld\n",
- (long long)(int)offsetof(struct lustre_mdt_attrs, lma_flags));
- LASSERTF((int)sizeof(((struct lustre_mdt_attrs *)0)->lma_flags) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct lustre_mdt_attrs *)0)->lma_flags));
LASSERTF(LMAI_RELEASED == 0x00000001UL, "found 0x%.8xUL\n",
(unsigned)LMAI_RELEASED);
LASSERTF(LMAC_HSM == 0x00000001UL, "found 0x%.8xUL\n",
log "want: stripe:$stripe_nr ost:$obdidx oid:$oid/$hex seq:$seq"
#don't unmount/remount the OSTs if we don't need to do that
- #local dir=$(facet_mntpt ost$ost)
- #stop ost$dev
- #do_facet ost$dev mount -t $FSTYPE $dev $dir $OST_MOUNT_OPTS ||
- # { error "mounting $dev as $FSTYPE failed"; return 3; }
- #local obj_file=$(do_facet ost$ost find $dir/O/$seq -name $oid)
- #local ff=$(do_facet ost$ost $LL_DECODE_FILTER_FID $obj_file)
- seq=$(echo $seq | sed -e "s/^0x//g")
- if [ $seq == 0 ]; then
- oid_hex=$(echo $oid)
- else
- oid_hex=$(echo $hex | sed -e "s/^0x//g")
+ # LU-2577 changes filter_fid to be smaller, so debugfs needs
+ # update too, until that use mount/ll_decode_filter_fid/mount
+ local dir=$(facet_mntpt ost$ost)
+ local opts=${OST_MOUNT_OPTS}
+
+ if ! do_facet ost$ost test -b ${dev}; then
+ opts=$(csa_add "$opts" -o loop)
fi
- local obj_file="O/$seq/d$((oid %32))/$oid_hex"
- local ff=$(do_facet ost$ost "$DEBUGFS -c -R 'stat $obj_file' \
- $dev 2>/dev/null" | grep "parent=")
+
+ stop ost$ost
+ do_facet ost$ost mount -t $(facet_fstype ost$ost) $opts $dev $dir ||
+ { error "mounting $dev as $FSTYPE failed"; return 3; }
+ local obj_file=$(do_facet ost$ost find $dir/O/$seq -name $oid)
+ local ff=$(do_facet ost$ost $LL_DECODE_FILTER_FID $obj_file)
+ do_facet ost$ost umount -d $dir
+ start ost$ost $dev $OST_MOUNT_OPTS
+
+ # re-enable when debugfs will understand new filter_fid
+ #seq=$(echo $seq | sed -e "s/^0x//g")
+ #if [ $seq == 0 ]; then
+ # oid_hex=$(echo $oid)
+ #else
+ # oid_hex=$(echo $hex | sed -e "s/^0x//g")
+ #fi
+ #local obj_file="O/$seq/d$((oid %32))/$oid_hex"
+ #local ff=$(do_facet ost$ost "$DEBUGFS -c -R 'stat $obj_file' \
+ # $dev 2>/dev/null" | grep "parent=")
[ -z "$ff" ] && error "$obj_file: no filter_fid info"
echo "$ff" | sed -e 's#.*objid=#got: objid=#'
- #do_facet ost$ost umount -d $dir
- #start ost$ost $dev $OST_MOUNT_OPTS
-
# /mnt/O/0/d23/23: objid=23 seq=0 parent=[0x200000400:0x1e:0x1]
# fid: objid=23 seq=0 parent=[0x200000400:0x1e:0x0] stripe=1
local ff_parent=$(echo $ff|sed -e 's/.*parent=.//')
struct filter_fid *ff = (void *)buf;
int size;
- size = getxattr(argv[i], "trusted.fid", buf, sizeof(buf));
+ size = getxattr(argv[i], "trusted.fid", buf,
+ sizeof(struct filter_fid_old));
if (size < 0) {
fprintf(stderr, "%s: error reading fid: %s\n",
argv[i], strerror(errno));
if (rc == 0)
rc = size;
- continue;
- }
- if (size > sizeof(*ff))
- fprintf(stderr, "%s: warning: fid larger than expected "
- "(%d bytes), recompile?\n", argv[i], size);
+ continue;
+ }
+ if (size > sizeof(struct filter_fid_old)) {
+ fprintf(stderr, "%s: warning: fid larger than expected"
+ " (%d bytes), recompile?\n", argv[i], size);
+ } else if (size > sizeof(*ff)) {
+ struct filter_fid_old *ffo = (void *)buf;
- printf("%s: objid="LPU64" seq="LPU64" parent="DFID"\n",
- argv[i], le64_to_cpu(ff->ff_objid),
- le64_to_cpu(ff->ff_seq),
- le64_to_cpu(ff->ff_parent.f_seq),
- le32_to_cpu(ff->ff_parent.f_oid),
- le32_to_cpu(ff->ff_parent.f_ver));
+ /* old filter_fid */
+ printf("%s: objid="LPU64" seq="LPU64" parent="DFID
+ " stripe=%u\n", argv[i],
+ le64_to_cpu(ffo->ff_objid),
+ le64_to_cpu(ffo->ff_seq),
+ le64_to_cpu(ffo->ff_parent.f_seq),
+ le32_to_cpu(ffo->ff_parent.f_oid), 0 /* ver */,
+ /* this is stripe_nr actually */
+ le32_to_cpu(ffo->ff_parent.f_ver));
+ } else {
+ printf("%s: parent="DFID" stripe=%u\n", argv[i],
+ le64_to_cpu(ff->ff_parent.f_seq),
+ le32_to_cpu(ff->ff_parent.f_oid), 0, /* ver */
+ /* this is stripe_nr actually */
+ le32_to_cpu(ff->ff_parent.f_ver));
+ }
}
return rc;
static int traverse_lost_found(char *src_dir, const char *mount_path)
{
- DIR *dir_ptr;
- struct filter_fid parent_fid;
- struct dirent64 *dirent;
+ DIR *dir_ptr;
+ struct lustre_mdt_attrs lma;
+ struct dirent64 *dirent;
__u64 ff_seq, ff_objid;
char *file_path;
char dest_path[PATH_MAX];
case DT_REG:
file_path = src_dir;
- xattr_len = getxattr(file_path, "trusted.fid",
- (void *)&parent_fid,
- sizeof(parent_fid));
-
- if (xattr_len == -1 || xattr_len < sizeof(parent_fid))
- /*
- * Its very much possible that we dont find fid
- * on precreated files, LAST_ID
- */
- continue;
+ xattr_len = getxattr(file_path, "trusted.lma",
+ (void *)&lma, sizeof(lma));
+ if (xattr_len == -1 || xattr_len < sizeof(lma)) {
+ struct filter_fid_old ff;
+
+ /* try old filter_fid EA */
+ xattr_len = getxattr(file_path, "trusted.fid",
+ (void *)&ff, sizeof(ff));
+ if (xattr_len == -1 || xattr_len < sizeof(ff)) {
+ /*
+ * Its very much possible that we dont find fid
+ * on precreated files, LAST_ID
+ */
+ continue;
+ }
+ ff_seq = le64_to_cpu(ff.ff_seq);
+ ff_objid = le64_to_cpu(ff.ff_objid);
+ } else {
+ ff_seq = le64_to_cpu(lma.lma_self_fid.f_seq);
+ ff_objid = le64_to_cpu(lma.lma_self_fid.f_oid);
+ }
- ff_seq = le64_to_cpu(parent_fid.ff_seq);
sprintf(seq_name, (fid_seq_is_rsvd(ff_seq) ||
fid_seq_is_mdt0(ff_seq)) ? LPU64 : LPX64i,
fid_seq_is_idif(ff_seq) ? 0 : ff_seq);
- ff_objid = le64_to_cpu(parent_fid.ff_objid);
- sprintf(obj_name, (fid_seq_is_rsvd(parent_fid.ff_seq) ||
- fid_seq_is_mdt0(parent_fid.ff_seq) ||
- fid_seq_is_idif(parent_fid.ff_seq)) ?
+ sprintf(obj_name, (fid_seq_is_rsvd(ff_seq) ||
+ fid_seq_is_mdt0(ff_seq) ||
+ fid_seq_is_idif(ff_seq)) ?
LPU64 : LPX64i, ff_objid);
grp_info = find_or_create_grp(&grp_info_list, ff_seq,
CHECK_MEMBER(lustre_mdt_attrs, lma_compat);
CHECK_MEMBER(lustre_mdt_attrs, lma_incompat);
CHECK_MEMBER(lustre_mdt_attrs, lma_self_fid);
- CHECK_MEMBER(lustre_mdt_attrs, lma_flags);
CHECK_VALUE_X(LMAI_RELEASED);
CHECK_VALUE_X(LMAC_HSM);
return ret;
}
-
void lustre_assert_wire_constants(void)
{
/* Wire protocol assertions generated by 'wirecheck'
* (make -C lustre/utils newwiretest)
- * running on Linux testnode 2.6.32-279.5.1.el6_lustre.g53f705f.x86_64 #1 SMP Mon Oct 8 05:12
+ * running on Linux node7 2.6.32 #1 SMP Tue Dec 18 04:02:25 MSK 2012 x86_64 x86_64 x86_64 GNU
* with gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) */
(long long)LU_SEQ_RANGE_OST);
/* Checks for struct lustre_mdt_attrs */
- LASSERTF((int)sizeof(struct lustre_mdt_attrs) == 32, "found %lld\n",
+ LASSERTF((int)sizeof(struct lustre_mdt_attrs) == 24, "found %lld\n",
(long long)(int)sizeof(struct lustre_mdt_attrs));
LASSERTF((int)offsetof(struct lustre_mdt_attrs, lma_compat) == 0, "found %lld\n",
(long long)(int)offsetof(struct lustre_mdt_attrs, lma_compat));
(long long)(int)offsetof(struct lustre_mdt_attrs, lma_self_fid));
LASSERTF((int)sizeof(((struct lustre_mdt_attrs *)0)->lma_self_fid) == 16, "found %lld\n",
(long long)(int)sizeof(((struct lustre_mdt_attrs *)0)->lma_self_fid));
- LASSERTF((int)offsetof(struct lustre_mdt_attrs, lma_flags) == 24, "found %lld\n",
- (long long)(int)offsetof(struct lustre_mdt_attrs, lma_flags));
- LASSERTF((int)sizeof(((struct lustre_mdt_attrs *)0)->lma_flags) == 8, "found %lld\n",
- (long long)(int)sizeof(((struct lustre_mdt_attrs *)0)->lma_flags));
LASSERTF(LMAI_RELEASED == 0x00000001UL, "found 0x%.8xUL\n",
(unsigned)LMAI_RELEASED);
LASSERTF(LMAC_HSM == 0x00000001UL, "found 0x%.8xUL\n",