AC_ARG_ENABLE([modules],
AC_HELP_STRING([--disable-modules],
[disable building of Lustre kernel modules]),
- [], [
+ [ AC_DEFINE(HAVE_NATIVE_LINUX_CLIENT, 1, [support native Linux client])], [
LC_TARGET_SUPPORTED([enable_modules="yes"],
[enable_modules="no"])
])
applications against the Lustre / LNet utilities libraries.
:> lustre-devel.files
-%if %{with lustre_modules}
-find . -type f -name '*.h' | grep uapi | sed 's/.*uapi\//usr\/include\//' >> lustre-devel.files
-%endif
%if %{with lustre_tests}
%package tests
%{_libdir}/liblustreapi.so
%endif
%{_includedir}/lustre
+%if %{with lustre_modules}
%{_includedir}/linux/lnet
%{_includedir}/linux/lustre
+%else
+%exclude %{_includedir}/linux/lnet
+%exclude %{_includedir}/linux/lustre
+%endif
%files -f lustre.files
%defattr(-,root,root)
* lquota data structures
*/
-#ifndef QUOTABLOCK_BITS
-# define QUOTABLOCK_BITS LUSTRE_QUOTABLOCK_BITS
-#endif
-
-#ifndef QUOTABLOCK_SIZE
-# define QUOTABLOCK_SIZE LUSTRE_QUOTABLOCK_SIZE
-#endif
-
-#ifndef toqb
-# define toqb lustre_stoqb
-#endif
-
/* The lquota_id structure is an union of all the possible identifier types that
* can be used with quota, this includes:
* - 64-bit user ID
/********* Quotas **********/
-#define LUSTRE_QUOTABLOCK_BITS 10
-#define LUSTRE_QUOTABLOCK_SIZE (1 << LUSTRE_QUOTABLOCK_BITS)
-
-static inline __u64 lustre_stoqb(__kernel_size_t space)
+/* From linux/fs/quota/quota.c */
+static inline __u64 toqb(__kernel_size_t space)
{
- return (space + LUSTRE_QUOTABLOCK_SIZE - 1) >> LUSTRE_QUOTABLOCK_BITS;
+ return (space + QIF_DQBLKSIZE - 1) >> QIF_DQBLKSIZE_BITS;
}
#define Q_QUOTACHECK 0x800100 /* deprecated as of 2.4 */
},
};
bool encrypt = false;
+ int hash_flags;
int err;
- ENTRY;
+ ENTRY;
if (unlikely(!lmv_user_magic_supported(lump->lum_magic)))
RETURN(-EINVAL);
LMV_HASH_TYPE_FNV_1A_64;
}
+ hash_flags = lump->lum_hash_type & ~LMV_HASH_TYPE_MASK;
+ if (hash_flags & ~LMV_HASH_FLAG_KNOWN)
+ RETURN(-EINVAL);
+
if (unlikely(!lmv_user_magic_supported(cpu_to_le32(lump->lum_magic))))
lustre_swab_lmv_user_md(lump);
RETURN(rc);
}
case LL_IOC_HSM_ACTION: {
- struct md_op_data *op_data;
- struct hsm_current_action *hca;
- int rc;
+ struct md_op_data *op_data;
+ struct hsm_current_action *hca;
+ const char *action;
+ int rc;
OBD_ALLOC_PTR(hca);
if (hca == NULL)
rc = obd_iocontrol(cmd, ll_i2mdexp(inode), sizeof(*op_data),
op_data, NULL);
+ if (rc < 0)
+ GOTO(skip_copy, rc);
+
+ /* The hsm_current_action retreived from the server could
+ * contain corrupt information. If it is incorrect data collect
+ * debug information. We still send the data even if incorrect
+ * to user land to handle.
+ */
+ action = hsm_user_action2name(hca->hca_action);
+ if (strcmp(action, "UNKNOWN") == 0 ||
+ hca->hca_state > HPS_DONE) {
+ CDEBUG(D_HSM,
+ "HSM current state %s action %s, offset = %llu, length %llu\n",
+ hsm_progress_state2name(hca->hca_state), action,
+ hca->hca_location.offset, hca->hca_location.length);
+ }
if (copy_to_user((char __user *)arg, hca, sizeof(*hca)))
rc = -EFAULT;
-
+skip_copy:
ll_finish_md_op_data(op_data);
OBD_FREE_PTR(hca);
RETURN(rc);
LASSERTF((int)sizeof(union lquota_id) == 16, "found %lld\n",
(long long)(int)sizeof(union lquota_id));
- LASSERTF(QUOTABLOCK_BITS == 10, "found %lld\n",
- (long long)QUOTABLOCK_BITS);
- LASSERTF(QUOTABLOCK_SIZE == 1024, "found %lld\n",
- (long long)QUOTABLOCK_SIZE);
+ LASSERTF(QIF_DQBLKSIZE_BITS == 10, "found %lld\n",
+ (long long)QIF_DQBLKSIZE_BITS);
+ LASSERTF(QIF_DQBLKSIZE == 1024, "found %lld\n",
+ (long long)QIF_DQBLKSIZE);
/* Checks for struct obd_quotactl */
LASSERTF((int)sizeof(struct obd_quotactl) == 112, "found %lld\n",
#include <sys/param.h>
#include <err.h>
-#include <uapi/linux/lustre/lustre_idl.h>
+#include <linux/lustre/lustre_idl.h>
#include <lustre/lustreapi.h>
#define syserr(exp, str, args...) \
return 0;
}
+#ifndef LCME_TEMPLATE_FLAGS
+#define LCME_TEMPLATE_FLAGS (LCME_FL_PREF_RW | LCME_FL_NOSYNC | \
+ LCME_FL_EXTENSION)
+#endif
+
static int build_layout_from_yaml_node(struct cYAML *node,
struct llapi_layout **layout,
struct lfs_setstripe_args *lsa,
LFS_FIND_PERM,
};
+#ifndef LCME_USER_MIRROR_FLAGS
+/* The mirror flags can be set by users at creation time. */
+#define LCME_USER_MIRROR_FLAGS (LCME_FL_PREF_RW)
+#endif
+
/* functions */
static int lfs_setstripe_internal(int argc, char **argv,
enum setstripe_origin opc)
return 0;
}
+/* special grace time, only notify the user when its quota is over soft limit
+ * but doesn't block new writes until the hard limit is reached.
+ */
+#define NOTIFY_GRACE "notify"
+#define NOTIFY_GRACE_TIME LQUOTA_GRACE_MASK
+
+#ifndef toqb
+static inline __u64 lustre_stoqb(size_t space)
+{
+ return (space + QIF_DQBLKSIZE - 1) >> QIF_DQBLKSIZE_BITS;
+}
+#else
+#define lustre_stoqb toqb
+#endif
+
int lfs_setquota_times(int argc, char **argv, struct if_quotactl *qctl)
{
int c, rc;
}
}
+#ifdef HAVE_NATIVE_CLIENT
+/* In the current Lustre implementation, the grace time is either the time
+ * or the timestamp to be used after some quota ID exceeds the soft limt,
+ * 48 bits should be enough, its high 16 bits can be used as quota flags.
+ */
+#define LQUOTA_GRACE_BITS 48
+#define LQUOTA_GRACE_MASK ((1ULL << LQUOTA_GRACE_BITS) - 1)
+#define LQUOTA_GRACE_MAX LQUOTA_GRACE_MASK
+#define LQUOTA_GRACE(t) (t & LQUOTA_GRACE_MASK)
+#define LQUOTA_FLAG(t) (t >> LQUOTA_GRACE_BITS)
+#define LQUOTA_GRACE_FLAG(t, f) ((__u64)t | (__u64)f << LQUOTA_GRACE_BITS)
+#endif
+
#define STRBUF_LEN 24
static void print_quota(char *mnt, struct if_quotactl *qctl, int type,
int rc, bool h, bool show_default)
return cid.cid_count;
}
+#ifndef MIRROR_ID_NEG
+#define MIRROR_ID_NEG 0x8000
+#endif
+
static inline int lfs_mirror_copy(int argc, char **argv)
{
int rc = CMD_HELP;
static char *get_llog_event_name(__u32 cmd)
{
+#ifdef HAVE_SERVER_SUPPORT
struct lcfg_type_data *data;
data = lcfg_cmd2data(cmd);
if (data)
return data->ltd_name;
+#endif
return NULL;
}
CHECK_UNION(lquota_id);
BLANK_LINE();
- CHECK_VALUE(QUOTABLOCK_BITS);
- CHECK_VALUE(QUOTABLOCK_SIZE);
+ CHECK_VALUE(QIF_DQBLKSIZE_BITS);
+ CHECK_VALUE(QIF_DQBLKSIZE);
BLANK_LINE();
CHECK_STRUCT(obd_quotactl);
LASSERTF((int)sizeof(union lquota_id) == 16, "found %lld\n",
(long long)(int)sizeof(union lquota_id));
- LASSERTF(QUOTABLOCK_BITS == 10, "found %lld\n",
- (long long)QUOTABLOCK_BITS);
- LASSERTF(QUOTABLOCK_SIZE == 1024, "found %lld\n",
- (long long)QUOTABLOCK_SIZE);
+ LASSERTF(QIF_DQBLKSIZE_BITS == 10, "found %lld\n",
+ (long long)QIF_DQBLKSIZE_BITS);
+ LASSERTF(QIF_DQBLKSIZE == 1024, "found %lld\n",
+ (long long)QIF_DQBLKSIZE_BITS);
/* Checks for struct obd_quotactl */
LASSERTF((int)sizeof(struct obd_quotactl) == 112, "found %lld\n",