- snprintf(fid_name, sizeof(fid_name), DFID_NOBRACE, PFID(fid));
+ lmd_size = sizeof(lmd->lmd_st) +
+ lov_user_md_size(LOV_MAX_STRIPE_COUNT, LOV_USER_MAGIC_V3);
+
+ if (lmd_size < sizeof(lmd->lmd_st) + XATTR_SIZE_MAX)
+ lmd_size = sizeof(lmd->lmd_st) + XATTR_SIZE_MAX;
+
+ if (lmd_size < FID_NOBRACE_LEN + 1)
+ lmd_size = FID_NOBRACE_LEN + 1;
+
+ lmd = malloc(lmd_size);
+ if (lmd == NULL)
+ return -ENOMEM;
+
+ snprintf((char *)lmd, lmd_size, DFID_NOBRACE, PFID(fid));
+
+ rc = ioctl(ct->open_by_fid_fd, IOC_MDC_GETFILEINFO, lmd);
+ if (rc != 0) {
+ rc = -errno;
+ llapi_error(LLAPI_MSG_ERROR, rc,
+ "cannot get metadata attributes of "DFID" in '%s'",
+ PFID(fid), ct->mnt);
+ goto out;
+ }
+
+ *st = lmd->lmd_st;
+out:
+ free(lmd);