unsigned int ddp_brw_size; /* optimal RPC size */
/* T10PI checksum type, zero if not supported */
enum cksum_types ddp_t10_cksum_type;
+ bool ddp_has_lseek_data_hole;
};
/**
int tgt_mdt_data_lock(struct ldlm_namespace *ns, struct ldlm_res_id *res_id,
struct lustre_handle *lh, int mode, __u64 *flags);
-void tgt_mdt_data_unlock(struct lustre_handle *lh, enum ldlm_mode mode);
int tgt_extent_lock(const struct lu_env *env, struct ldlm_namespace *ns,
struct ldlm_res_id *res_id, __u64 start, __u64 end,
struct lustre_handle *lh, int mode, __u64 *flags);
-void tgt_extent_unlock(struct lustre_handle *lh, enum ldlm_mode mode);
+void tgt_data_unlock(struct lustre_handle *lh, enum ldlm_mode mode);
int tgt_brw_read(struct tgt_session_info *tsi);
int tgt_brw_write(struct tgt_session_info *tsi);
+int tgt_lseek(struct tgt_session_info *tsi);
int tgt_hpreq_handler(struct ptlrpc_request *req);
void tgt_register_lfsck_in_notify_local(int (*notify)(const struct lu_env *,
struct dt_device *,
extern struct req_format RQF_OST_SET_INFO_LAST_FID;
extern struct req_format RQF_OST_GET_INFO_FIEMAP;
extern struct req_format RQF_OST_LADVISE;
+extern struct req_format RQF_OST_SEEK;
/* LDLM req_format */
extern struct req_format RQF_LDLM_ENQUEUE;
#define OBD_FAIL_OST_PREPARE_DELAY 0x247
#define OBD_FAIL_OST_2BIG_NIOBUF 0x248
#define OBD_FAIL_OST_FALLOCATE_NET 0x249
+#define OBD_FAIL_OST_SEEK_NET 0x24a
#define OBD_FAIL_OST_WR_ATTR_DELAY 0x250
#define OBD_FAIL_LDLM 0x300
#define OBD_CONNECT2_ENCRYPT 0x8000ULL /* client-to-disk encrypt */
#define OBD_CONNECT2_FIDMAP 0x10000ULL /* FID map */
#define OBD_CONNECT2_GETATTR_PFID 0x20000ULL /* pack parent FID in getattr */
+#define OBD_CONNECT2_LSEEK 0x40000ULL /* SEEK_HOLE/DATA RPC */
/* XXX README XXX:
* Please DO NOT add flag values here before first ensuring that this same
* flag value is not in use on some other branch. Please clear any such
OBD_CONNECT2_PCC | \
OBD_CONNECT2_CRUSH | \
OBD_CONNECT2_ENCRYPT | \
- OBD_CONNECT2_GETATTR_PFID)
+ OBD_CONNECT2_GETATTR_PFID |\
+ OBD_CONNECT2_LSEEK)
#define OST_CONNECT_SUPPORTED (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \
OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \
OBD_CONNECT_SHORTIO | OBD_CONNECT_FLAGS2)
#define OST_CONNECT_SUPPORTED2 (OBD_CONNECT2_LOCKAHEAD | OBD_CONNECT2_INC_XID |\
- OBD_CONNECT2_ENCRYPT)
+ OBD_CONNECT2_ENCRYPT | OBD_CONNECT2_LSEEK)
#define ECHO_CONNECT_SUPPORTED (OBD_CONNECT_FID)
#define ECHO_CONNECT_SUPPORTED2 0
OST_QUOTA_ADJUST_QUNIT = 20, /* not used since 2.4 */
OST_LADVISE = 21,
OST_FALLOCATE = 22,
+ OST_SEEK = 23,
OST_LAST_OPC /* must be < 33 to avoid MDS_GETATTR */
};
#define OST_FIRST_OPC OST_REPLY
OST_PUNCH, mdt_punch_hdl,
mdt_hp_punch),
TGT_OST_HDL(HAS_BODY | HAS_REPLY, OST_SYNC, mdt_data_sync),
+TGT_OST_HDL(HAS_BODY | HAS_REPLY, OST_SEEK, tgt_lseek),
};
static struct tgt_handler mdt_sec_ctx_ops[] = {
mdt_enable_slc(mdt);
}
+ if (!mdt->mdt_lut.lut_dt_conf.ddp_has_lseek_data_hole)
+ data->ocd_connect_flags2 &= ~OBD_CONNECT2_LSEEK;
+
return 0;
}
lu_object_put(tsi->tsi_env, &mo->mot_obj);
out_unlock:
if (srvlock)
- tgt_extent_unlock(&lh, LCK_PW);
+ tgt_data_unlock(&lh, LCK_PW);
out:
mdt_thread_info_fini(info);
return rc;
rc = 0;
out:
if (srvlock)
- tgt_mdt_data_unlock(&lh, lock_mode);
+ tgt_data_unlock(&lh, lock_mode);
repbody->mbo_valid |= OBD_MD_FLFLAGS;
repbody->mbo_flags = OBD_FL_FLUSH;
"client_encryption", /* 0x8000 */
"fidmap", /* 0x10000 */
"getattr_pfid", /* 0x20000 */
+ "lseek", /* 0x40000 */
NULL
};
return rc;
CDEBUG(D_OTHER, "ost lock [%llu,%llu], lh=%p\n", begin, end, &lh);
- tgt_extent_unlock(&lh, LCK_PR);
+ tgt_data_unlock(&lh, LCK_PR);
return 0;
}
ofd_object_put(tsi->tsi_env, fo);
out:
if (srvlock)
- tgt_extent_unlock(&lh, lock_mode);
+ tgt_data_unlock(&lh, lock_mode);
ofd_counter_incr(tsi->tsi_exp, LPROC_OFD_STATS_GETATTR,
tsi->tsi_jobid, ktime_us_delta(ktime_get(), kstart));
ofd_object_put(tsi->tsi_env, fo);
out:
if (srvlock)
- tgt_extent_unlock(&lh, LCK_PW);
+ tgt_data_unlock(&lh, LCK_PW);
if (rc == 0) {
res = ldlm_resource_get(ns, NULL, &tsi->tsi_resid,
LDLM_EXTENT, 0);
RETURN(rc);
}
-
/**
* OFD request handler for OST_PUNCH RPC.
*
ofd_object_put(tsi->tsi_env, fo);
out:
if (srvlock)
- tgt_extent_unlock(&lh, LCK_PW);
+ tgt_data_unlock(&lh, LCK_PW);
if (rc == 0) {
/* we do not call this before to avoid lu_object_find() in
* ->lvbo_update() holding another reference on the object.
req->rq_status = ofd_ladvise_prefetch(env, fo,
tbc->local,
start, end, dbt);
- tgt_extent_unlock(&lockh, LCK_PR);
+ tgt_data_unlock(&lockh, LCK_PR);
break;
case LU_LADVISE_DONTNEED:
rc = dt_ladvise(env, dob, ladvise->lla_start,
TGT_OST_HDL(HAS_BODY | HAS_REPLY, OST_SYNC, ofd_sync_hdl),
TGT_OST_HDL(HAS_REPLY, OST_QUOTACTL, ofd_quotactl),
TGT_OST_HDL(HAS_BODY | HAS_REPLY, OST_LADVISE, ofd_ladvise_hdl),
-TGT_OST_HDL(HAS_BODY | HAS_REPLY | IS_MUTABLE, OST_FALLOCATE, ofd_fallocate_hdl)
+TGT_OST_HDL(HAS_BODY | HAS_REPLY | IS_MUTABLE, OST_FALLOCATE, ofd_fallocate_hdl),
+TGT_OST_HDL(HAS_BODY | HAS_REPLY, OST_SEEK, tgt_lseek),
};
static struct tgt_opc_slice ofd_common_slice[] = {
}
}
+ if (!ofd->ofd_lut.lut_dt_conf.ddp_has_lseek_data_hole)
+ data->ocd_connect_flags2 &= ~OBD_CONNECT2_LSEEK;
+
RETURN(0);
}
d->od_svname, name);
}
}
+
+ param->ddp_has_lseek_data_hole = true;
}
static struct super_block *osd_mnt_sb_get(const struct dt_device *d)
LASSERT(dt_object_exists(dt));
LASSERT(osd_invariant(obj));
LASSERT(inode);
+ LASSERT(offset >= 0);
file = osd_quasi_file(env, inode);
result = file->f_op->llseek(file, offset, whence);
- /* when result is out of file range then it must be virtual hole
- * at the end of file, but this is not real file end, so return
- * just -ENXIO and LOV will merge all results
+
+ /*
+ * If 'offset' is beyond end of object file then treat it as not error
+ * but valid case for SEEK_HOLE and return 'offset' as result.
+ * LOV will decide if it is beyond real end of file or not.
*/
- if (result == i_size_read(inode))
- result = -ENXIO;
+ if (whence == SEEK_HOLE && result == -ENXIO)
+ result = offset;
CDEBUG(D_INFO, "seek %s from %lld: %lld\n", whence == SEEK_HOLE ?
"hole" : "data", offset, result);
param->ddp_brw_size = osd->od_max_blksz;
else
param->ddp_brw_size = ONE_MB_BRW_SIZE;
+
+#ifdef HAVE_DMU_OFFSET_NEXT
+ param->ddp_has_lseek_data_hole = true;
+#else
+ param->ddp_has_lseek_data_hole = false;
+#endif
}
/*
#define inode_timespec_t timestruc_t
#endif
+#ifdef HAVE_DMU_OFFSET_NEXT
+#define osd_dmu_offset_next(os, obj, hole, res) \
+ dmu_offset_next((os), (obj), (hole), (res))
+#else
+#define osd_dmu_offset_next(os, obj, hole, res) (EBUSY)
+#endif
+
#endif /* _OSD_INTERNAL_H */
LASSERT(dt_object_exists(dt));
LASSERT(osd_invariant(obj));
+ LASSERT(offset >= 0);
- if (offset < 0 || offset >= size)
- RETURN(-ENXIO);
+ /* for SEEK_HOLE treat 'offset' beyond the end of file as in real
+ * hole. LOV to decide after all if that real hole or not.
+ */
+ if (offset >= size)
+ RETURN(hole ? offset : -ENXIO);
-#ifdef HAVE_DMU_OFFSET_NEXT
- rc = dmu_offset_next(osd_obj2dev(obj)->od_os, obj->oo_dn->dn_object,
- hole, &result);
+ rc = osd_dmu_offset_next(osd_obj2dev(obj)->od_os,
+ obj->oo_dn->dn_object, hole, &result);
if (rc == ESRCH)
RETURN(-ENXIO);
-#else
- /*
- * In absence of dmu_offset_next() just do nothing but
- * return EBUSY as does dmu_offset_next() and that means
- * generic approach should be used.
+
+ /* file was dirty, so fall back to using generic logic:
+ * For HOLE return file size, for DATA the result is set
+ * already to the 'offset' parameter value.
*/
- rc = EBUSY;
-#endif
- /* file was dirty, so fall back to using generic logic */
if (rc == EBUSY && hole)
- RETURN(-ENXIO); /* see comment below */
+ result = size;
- /* when result is out of file range then it must be virtual hole
- * at the end of file, but this is not real file end, so return
- * just -ENXIO and LOV will translate it properly.
+ /* dmu_offset_next() only works on whole blocks so may return SEEK_HOLE
+ * result as end of the last block instead of logical EOF which we need
*/
- if (result >= size)
- RETURN(-ENXIO);
+ if (result > size)
+ result = size;
RETURN(result);
}
&RQF_OST_SET_INFO_LAST_FID,
&RQF_OST_GET_INFO_FIEMAP,
&RQF_OST_LADVISE,
+ &RQF_OST_SEEK,
&RQF_LDLM_ENQUEUE,
&RQF_LDLM_ENQUEUE_LVB,
&RQF_LDLM_CONVERT,
DEFINE_REQ_FMT0("OST_FALLOCATE", ost_body_capa, ost_body_only);
EXPORT_SYMBOL(RQF_OST_FALLOCATE);
+struct req_format RQF_OST_SEEK =
+ DEFINE_REQ_FMT0("OST_SEEK", ost_body_only, ost_body_only);
+EXPORT_SYMBOL(RQF_OST_SEEK);
+
struct req_format RQF_OST_SYNC =
DEFINE_REQ_FMT0("OST_SYNC", ost_body_capa, ost_body_only);
EXPORT_SYMBOL(RQF_OST_SYNC);
{ OST_QUOTACTL, "ost_quotactl" },
{ OST_QUOTA_ADJUST_QUNIT, "ost_quota_adjust_qunit" },
{ OST_LADVISE, "ost_ladvise" },
- { OST_FALLOCATE, "ost_fallocate"},
+ { OST_FALLOCATE, "ost_fallocate" },
+ { OST_SEEK, "ost_seek" },
{ MDS_GETATTR, "mds_getattr" },
{ MDS_GETATTR_NAME, "mds_getattr_lock" },
{ MDS_CLOSE, "mds_close" },
(long long)OST_LADVISE);
LASSERTF(OST_FALLOCATE == 22, "found %lld\n",
(long long)OST_FALLOCATE);
- LASSERTF(OST_LAST_OPC == 23, "found %lld\n",
+ LASSERTF(OST_SEEK == 23, "found %lld\n",
+ (long long)OST_SEEK);
+ LASSERTF(OST_LAST_OPC == 24, "found %lld\n",
(long long)OST_LAST_OPC);
LASSERTF(OBD_OBJECT_EOF == 0xffffffffffffffffULL, "found 0x%.16llxULL\n",
OBD_OBJECT_EOF);
LASSERTF(LMAI_ORPHAN == 0x00000010UL, "found 0x%.8xUL\n",
(unsigned)LMAI_ORPHAN);
LASSERTF(LMAI_ENCRYPT == 0x00000020UL, "found 0x%.8xUL\n",
- (unsigned)LMAI_ENCRYPT);
+ (unsigned)LMAI_ENCRYPT);
/* Checks for struct lustre_ost_attrs */
LASSERTF((int)sizeof(struct lustre_ost_attrs) == 64, "found %lld\n",
OBD_CONNECT2_ASYNC_DISCARD);
LASSERTF(OBD_CONNECT2_ENCRYPT == 0x8000ULL, "found 0x%.16llxULL\n",
OBD_CONNECT2_ENCRYPT);
- LASSERTF(OBD_CONNECT2_FIDMAP== 0x10000ULL, "found 0x%.16llxULL\n",
+ LASSERTF(OBD_CONNECT2_FIDMAP == 0x10000ULL, "found 0x%.16llxULL\n",
OBD_CONNECT2_FIDMAP);
- LASSERTF(OBD_CONNECT2_GETATTR_PFID== 0x20000ULL, "found 0x%.16llxULL\n",
+ LASSERTF(OBD_CONNECT2_GETATTR_PFID == 0x20000ULL, "found 0x%.16llxULL\n",
OBD_CONNECT2_GETATTR_PFID);
+ LASSERTF(OBD_CONNECT2_LSEEK == 0x40000ULL, "found 0x%.16llxULL\n",
+ OBD_CONNECT2_LSEEK);
LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n",
(unsigned)OBD_CKSUM_CRC32);
LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n",
LASSERTF(LUSTRE_SET_SYNC_FL == 0x00040000UL, "found 0x%.8xUL\n",
(unsigned)LUSTRE_SET_SYNC_FL);
LASSERTF(LUSTRE_ENCRYPT_FL == 0x00800000UL, "found 0x%.8xUL\n",
- (unsigned)LUSTRE_ENCRYPT_FL);
+ (unsigned)LUSTRE_ENCRYPT_FL);
LASSERTF(MDS_INODELOCK_LOOKUP == 0x00000001UL, "found 0x%.8xUL\n",
(unsigned)MDS_INODELOCK_LOOKUP);
LASSERTF(MDS_INODELOCK_UPDATE == 0x00000002UL, "found 0x%.8xUL\n",
}
EXPORT_SYMBOL(tgt_mdt_data_lock);
-void tgt_mdt_data_unlock(struct lustre_handle *lh, enum ldlm_mode mode)
-{
- LASSERT(lustre_handle_is_used(lh));
- ldlm_lock_decref(lh, mode);
-}
-EXPORT_SYMBOL(tgt_mdt_data_unlock);
-
/**
* Helper function for getting server side [start, start+count] DLM lock
* if asked by client.
}
EXPORT_SYMBOL(tgt_extent_lock);
-void tgt_extent_unlock(struct lustre_handle *lh, enum ldlm_mode mode)
+static int tgt_data_lock(const struct lu_env *env, struct obd_export *exp,
+ struct ldlm_res_id *res_id, __u64 start, __u64 end,
+ struct lustre_handle *lh, enum ldlm_mode mode)
+{
+ struct ldlm_namespace *ns = exp->exp_obd->obd_namespace;
+ __u64 flags = 0;
+
+ /* MDT IO for data-on-mdt */
+ if (exp->exp_connect_data.ocd_connect_flags & OBD_CONNECT_IBITS)
+ return tgt_mdt_data_lock(ns, res_id, lh, mode, &flags);
+
+ return tgt_extent_lock(env, ns, res_id, start, end, lh, mode, &flags);
+}
+
+void tgt_data_unlock(struct lustre_handle *lh, enum ldlm_mode mode)
{
LASSERT(lustre_handle_is_used(lh));
ldlm_lock_decref(lh, mode);
}
-EXPORT_SYMBOL(tgt_extent_unlock);
+EXPORT_SYMBOL(tgt_data_unlock);
static int tgt_brw_lock(const struct lu_env *env, struct obd_export *exp,
struct ldlm_res_id *res_id, struct obd_ioobj *obj,
struct niobuf_remote *nb, struct lustre_handle *lh,
enum ldlm_mode mode)
{
- struct ldlm_namespace *ns = exp->exp_obd->obd_namespace;
- __u64 flags = 0;
- int nrbufs = obj->ioo_bufcnt;
- int i;
- int rc;
+ int nrbufs = obj->ioo_bufcnt;
+ int i;
ENTRY;
LASSERT(mode == LCK_PR || mode == LCK_PW);
LASSERT(!lustre_handle_is_used(lh));
- if (ns->ns_obd->obd_recovering)
+ if (exp->exp_obd->obd_recovering)
RETURN(0);
if (nrbufs == 0 || !(nb[0].rnb_flags & OBD_BRW_SRVLOCK))
if (!(nb[i].rnb_flags & OBD_BRW_SRVLOCK))
RETURN(-EFAULT);
- /* MDT IO for data-on-mdt */
- if (exp->exp_connect_data.ocd_connect_flags & OBD_CONNECT_IBITS)
- rc = tgt_mdt_data_lock(ns, res_id, lh, mode, &flags);
- else
- rc = tgt_extent_lock(env, ns, res_id, nb[0].rnb_offset,
- nb[nrbufs - 1].rnb_offset +
- nb[nrbufs - 1].rnb_len - 1,
- lh, mode, &flags);
- RETURN(rc);
+ return tgt_data_lock(env, exp, res_id, nb[0].rnb_offset,
+ nb[nrbufs - 1].rnb_offset +
+ nb[nrbufs - 1].rnb_len - 1, lh, mode);
}
static void tgt_brw_unlock(struct obd_export *exp, struct obd_ioobj *obj,
lustre_handle_is_used(lh));
if (lustre_handle_is_used(lh))
- tgt_extent_unlock(lh, mode);
+ tgt_data_unlock(lh, mode);
EXIT;
}
}
EXPORT_SYMBOL(tgt_brw_write);
+/**
+ * Common request handler for OST_SEEK RPC.
+ *
+ * Unified request handling for OST_SEEK RPC.
+ * It takes object by its FID, does needed lseek and packs result
+ * into reply. Only SEEK_HOLE and SEEK_DATA are supported.
+ *
+ * \param[in] tsi target session environment for this request
+ *
+ * \retval 0 if successful
+ * \retval negative value on error
+ */
+int tgt_lseek(struct tgt_session_info *tsi)
+{
+ struct lustre_handle lh = { 0 };
+ struct dt_object *dob;
+ struct ost_body *repbody;
+ loff_t offset = tsi->tsi_ost_body->oa.o_size;
+ int whence = tsi->tsi_ost_body->oa.o_mode;
+ bool srvlock;
+ int rc = 0;
+
+ ENTRY;
+
+ if (whence != SEEK_HOLE && whence != SEEK_DATA)
+ RETURN(-EPROTO);
+
+ /* Negative offset is prohibited on wire and must be handled on client
+ * prior sending RPC.
+ */
+ if (offset < 0)
+ RETURN(-EPROTO);
+
+ repbody = req_capsule_server_get(tsi->tsi_pill, &RMF_OST_BODY);
+ if (repbody == NULL)
+ RETURN(-ENOMEM);
+ repbody->oa = tsi->tsi_ost_body->oa;
+
+ srvlock = tsi->tsi_ost_body->oa.o_valid & OBD_MD_FLFLAGS &&
+ tsi->tsi_ost_body->oa.o_flags & OBD_FL_SRVLOCK;
+ if (srvlock) {
+ rc = tgt_data_lock(tsi->tsi_env, tsi->tsi_exp, &tsi->tsi_resid,
+ offset, OBD_OBJECT_EOF, &lh, LCK_PR);
+ if (rc)
+ RETURN(rc);
+ }
+
+ dob = dt_locate(tsi->tsi_env, tsi->tsi_tgt->lut_bottom, &tsi->tsi_fid);
+ if (IS_ERR(dob))
+ GOTO(out, rc = PTR_ERR(dob));
+
+ if (!dt_object_exists(dob))
+ GOTO(obj_put, rc = -ENOENT);
+
+ repbody->oa.o_size = dt_lseek(tsi->tsi_env, dob, offset, whence);
+ rc = 0;
+obj_put:
+ dt_object_put(tsi->tsi_env, dob);
+out:
+ if (srvlock)
+ tgt_data_unlock(&lh, LCK_PR);
+
+ RETURN(rc);
+}
+EXPORT_SYMBOL(tgt_lseek);
+
/* Check if request can be reconstructed from saved reply data
* A copy of the reply data is returned in @trd if the pointer is not NULL
*/
CHECK_DEFINE_64X(OBD_CONNECT2_ENCRYPT);
CHECK_DEFINE_64X(OBD_CONNECT2_FIDMAP);
CHECK_DEFINE_64X(OBD_CONNECT2_GETATTR_PFID);
+ CHECK_DEFINE_64X(OBD_CONNECT2_LSEEK);
CHECK_VALUE_X(OBD_CKSUM_CRC32);
CHECK_VALUE_X(OBD_CKSUM_ADLER);
CHECK_CDEFINE(LMV_HASH_TYPE_MASK);
CHECK_CDEFINE(LMV_HASH_FLAG_MERGE);
CHECK_CDEFINE(LMV_HASH_FLAG_SPLIT);
+ CHECK_CDEFINE(LMV_HASH_FLAG_LOST_LMV);
CHECK_CDEFINE(LMV_HASH_FLAG_BAD_TYPE);
CHECK_CDEFINE(LMV_HASH_FLAG_MIGRATION);
CHECK_CDEFINE(LMV_CRUSH_PG_COUNT);
CHECK_MEMBER(mdt_body, mbo_projid);
CHECK_MEMBER(mdt_body, mbo_dom_size);
CHECK_MEMBER(mdt_body, mbo_dom_blocks);
- CHECK_MEMBER(mdt_body, mbo_padding_8);
+ CHECK_MEMBER(mdt_body, mbo_btime);
CHECK_MEMBER(mdt_body, mbo_padding_9);
CHECK_MEMBER(mdt_body, mbo_padding_10);
CHECK_VALUE(OST_QUOTA_ADJUST_QUNIT);
CHECK_VALUE(OST_LADVISE);
CHECK_VALUE(OST_FALLOCATE);
+ CHECK_VALUE(OST_SEEK);
CHECK_VALUE(OST_LAST_OPC);
CHECK_DEFINE_64X(OBD_OBJECT_EOF);
#define LASSERT(cond) if (!(cond)) { printf("failed " #cond "\n"); ret = 1; }
#define LASSERTF(cond, fmt, ...) if (!(cond)) { printf("failed '" #cond "'" fmt, ## __VA_ARGS__); ret = 1; }
/*
- * BUILD_BUG_ON() is Compile-time LASSERT, which verifies correctness at
+ * BUILD_BUG_ON() is Compile-time check which verifies correctness at
* compile-time rather than runtime. If "cond" is true, then there are two
* identical cases ("0" and "0"), which is an error that causes the compiler to
* complain. If "cond" is false, then there are two different cases
#include <linux/lustre/lustre_lfsck_user.h>
#include <linux/lustre/lustre_disk.h>
#ifdef CONFIG_FS_POSIX_ACL
-#ifdef HAVE_STRUCT_POSIX_ACL_XATTR
#include <linux/posix_acl_xattr.h>
+#ifdef HAVE_STRUCT_POSIX_ACL_XATTR
# define posix_acl_xattr_header struct posix_acl_xattr_header
# define posix_acl_xattr_entry struct posix_acl_xattr_entry
#endif /* HAVE_STRUCT_POSIX_ACL_XATTR */
#include <linux/lustre/lustre_cfg.h>
#define LASSERT(cond) if (!(cond)) { printf("failed " #cond "\n"); ret = 1; }
-#define LASSERTF(cond, fmt, ...) if (!(cond)) { printf("failed '" #cond "'" fmt, ## __VA_ARGS__);ret = 1;}
+#define LASSERTF(cond, fmt, ...) if (!(cond)) { printf("failed '" #cond "'" fmt, ## __VA_ARGS__); ret = 1; }
/*
* BUILD_BUG_ON() is Compile-time check which verifies correctness at
- * compile-time rather than runtime.
+ * compile-time rather than runtime. If "cond" is true, then there are two
+ * identical cases ("0" and "0"), which is an error that causes the compiler to
+ * complain. If "cond" is false, then there are two different cases
+ * ("(non-zero)" and "0").
+ *
*/
-#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
+#ifndef BUILD_BUG_ON
+#define BUILD_BUG_ON(cond) do {switch (0) {case (cond): case 1: break; } } while (0)
+#endif
int ret;
(long long)OST_LADVISE);
LASSERTF(OST_FALLOCATE == 22, "found %lld\n",
(long long)OST_FALLOCATE);
- LASSERTF(OST_LAST_OPC == 23, "found %lld\n",
+ LASSERTF(OST_SEEK == 23, "found %lld\n",
+ (long long)OST_SEEK);
+ LASSERTF(OST_LAST_OPC == 24, "found %lld\n",
(long long)OST_LAST_OPC);
LASSERTF(OBD_OBJECT_EOF == 0xffffffffffffffffULL, "found 0x%.16llxULL\n",
OBD_OBJECT_EOF);
LASSERTF(LMAI_ORPHAN == 0x00000010UL, "found 0x%.8xUL\n",
(unsigned)LMAI_ORPHAN);
LASSERTF(LMAI_ENCRYPT == 0x00000020UL, "found 0x%.8xUL\n",
- (unsigned)LMAI_ENCRYPT);
+ (unsigned)LMAI_ENCRYPT);
/* Checks for struct lustre_ost_attrs */
LASSERTF((int)sizeof(struct lustre_ost_attrs) == 64, "found %lld\n",
OBD_CONNECT2_ASYNC_DISCARD);
LASSERTF(OBD_CONNECT2_ENCRYPT == 0x8000ULL, "found 0x%.16llxULL\n",
OBD_CONNECT2_ENCRYPT);
- LASSERTF(OBD_CONNECT2_FIDMAP== 0x10000ULL, "found 0x%.16llxULL\n",
+ LASSERTF(OBD_CONNECT2_FIDMAP == 0x10000ULL, "found 0x%.16llxULL\n",
OBD_CONNECT2_FIDMAP);
- LASSERTF(OBD_CONNECT2_GETATTR_PFID== 0x20000ULL, "found 0x%.16llxULL\n",
+ LASSERTF(OBD_CONNECT2_GETATTR_PFID == 0x20000ULL, "found 0x%.16llxULL\n",
OBD_CONNECT2_GETATTR_PFID);
+ LASSERTF(OBD_CONNECT2_LSEEK == 0x40000ULL, "found 0x%.16llxULL\n",
+ OBD_CONNECT2_LSEEK);
LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n",
(unsigned)OBD_CKSUM_CRC32);
LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n",
LASSERTF(LUSTRE_SET_SYNC_FL == 0x00040000UL, "found 0x%.8xUL\n",
(unsigned)LUSTRE_SET_SYNC_FL);
LASSERTF(LUSTRE_ENCRYPT_FL == 0x00800000UL, "found 0x%.8xUL\n",
- (unsigned)LUSTRE_ENCRYPT_FL);
+ (unsigned)LUSTRE_ENCRYPT_FL);
LASSERTF(MDS_INODELOCK_LOOKUP == 0x00000001UL, "found 0x%.8xUL\n",
(unsigned)MDS_INODELOCK_LOOKUP);
LASSERTF(MDS_INODELOCK_UPDATE == 0x00000002UL, "found 0x%.8xUL\n",