From ae052f9f2e2699389617cbd12cc815f77f7e499b Mon Sep 17 00:00:00 2001 From: Dmitry Eremin Date: Fri, 19 Dec 2014 17:09:55 +0300 Subject: [PATCH] LU-5478 obdclass: get rid of obd_* typedefs We have a bunch of typedefs for common things that made no sense and hid the actual type from plain view. Replace them with proper uXX or sXX types. Exception is in lustre_idl.h and lustre_ioctl.h where they are replaced with __uXX and __sXX to be able to be included in userspace patch 5 in series: modify obdclass/obdecho/ofd Signed-off-by: Oleg Drokin Signed-off-by: Dmitry Eremin Change-Id: I674972390c808001249ce3c23a9f58888c13d1be Reviewed-on: http://review.whamcloud.com/13146 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: James Simmons --- lustre/obdclass/cl_io.c | 2 +- lustre/obdclass/linux/linux-obdo.c | 6 +-- lustre/obdclass/local_storage.c | 4 +- lustre/obdclass/obdo.c | 10 ++--- lustre/obdecho/echo.c | 18 ++++---- lustre/obdecho/echo_client.c | 63 ++++++++++++++-------------- lustre/ofd/ofd_capa.c | 2 +- lustre/ofd/ofd_dev.c | 22 +++++----- lustre/ofd/ofd_fs.c | 14 +++---- lustre/ofd/ofd_grant.c | 84 +++++++++++++++++++------------------- lustre/ofd/ofd_internal.h | 26 ++++++------ lustre/ofd/ofd_io.c | 6 +-- lustre/ofd/ofd_obd.c | 12 +++--- lustre/ofd/ofd_objects.c | 4 +- 14 files changed, 135 insertions(+), 138 deletions(-) diff --git a/lustre/obdclass/cl_io.c b/lustre/obdclass/cl_io.c index 3d05da9..60ea8f8 100644 --- a/lustre/obdclass/cl_io.c +++ b/lustre/obdclass/cl_io.c @@ -1424,7 +1424,7 @@ EXPORT_SYMBOL(cl_req_prep); * for the same request. */ void cl_req_attr_set(const struct lu_env *env, struct cl_req *req, - struct cl_req_attr *attr, obd_valid flags) + struct cl_req_attr *attr, u64 flags) { const struct cl_req_slice *slice; struct cl_page *page; diff --git a/lustre/obdclass/linux/linux-obdo.c b/lustre/obdclass/linux/linux-obdo.c index 97192ff..2db5a46 100644 --- a/lustre/obdclass/linux/linux-obdo.c +++ b/lustre/obdclass/linux/linux-obdo.c @@ -51,7 +51,7 @@ /*FIXME: Just copy from obdo_from_inode*/ void obdo_from_la(struct obdo *dst, const struct lu_attr *la, __u64 valid) { - obd_flag newvalid = 0; + u32 newvalid = 0; if (valid & LA_ATIME) { dst->o_atime = la->la_atime; @@ -100,7 +100,7 @@ void obdo_from_la(struct obdo *dst, const struct lu_attr *la, __u64 valid) EXPORT_SYMBOL(obdo_from_la); /*FIXME: Just copy from obdo_from_inode*/ -void la_from_obdo(struct lu_attr *dst, const struct obdo *obdo, obd_flag valid) +void la_from_obdo(struct lu_attr *dst, const struct obdo *obdo, u32 valid) { __u64 newvalid = 0; @@ -153,7 +153,7 @@ void la_from_obdo(struct lu_attr *dst, const struct obdo *obdo, obd_flag valid) EXPORT_SYMBOL(la_from_obdo); void obdo_refresh_inode(struct inode *dst, const struct obdo *src, - obd_flag valid) + u32 valid) { valid &= src->o_valid; diff --git a/lustre/obdclass/local_storage.c b/lustre/obdclass/local_storage.c index 3672f01..8cae2a2 100644 --- a/lustre/obdclass/local_storage.c +++ b/lustre/obdclass/local_storage.c @@ -254,7 +254,7 @@ int local_object_create(const struct lu_env *env, struct dt_object_format *dof, struct thandle *th) { struct dt_thread_info *dti = dt_info(env); - obd_id lastid; + u64 lastid; int rc; ENTRY; @@ -786,7 +786,7 @@ int local_oid_storage_init(const struct lu_env *env, struct dt_device *dev, { struct dt_thread_info *dti = dt_info(env); struct ls_device *ls; - obd_id lastid; + u64 lastid; struct dt_object *o = NULL; struct thandle *th; __u32 first_oid = fid_oid(first_fid); diff --git a/lustre/obdclass/obdo.c b/lustre/obdclass/obdo.c index 2868954..efba1bc 100644 --- a/lustre/obdclass/obdo.c +++ b/lustre/obdclass/obdo.c @@ -56,9 +56,9 @@ EXPORT_SYMBOL(obdo_set_parent_fid); /* WARNING: the file systems must take care not to tinker with attributes they don't manage (such as blocks). */ -void obdo_from_inode(struct obdo *dst, struct inode *src, obd_flag valid) +void obdo_from_inode(struct obdo *dst, struct inode *src, u32 valid) { - obd_flag newvalid = 0; + u32 newvalid = 0; if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME)) CDEBUG(D_INODE, "valid %x, new time %lu/%lu\n", @@ -115,7 +115,7 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, obd_flag valid) } EXPORT_SYMBOL(obdo_from_inode); -void obdo_cpy_md(struct obdo *dst, const struct obdo *src, obd_flag valid) +void obdo_cpy_md(struct obdo *dst, const struct obdo *src, u32 valid) { CDEBUG(D_INODE, "src obdo "DOSTID" valid "LPX64", dst obdo "DOSTID"\n", POSTID(&src->o_oi), src->o_valid, POSTID(&dst->o_oi)); @@ -169,7 +169,7 @@ void obdo_to_ioobj(const struct obdo *oa, struct obd_ioobj *ioobj) EXPORT_SYMBOL(obdo_to_ioobj); static void iattr_from_obdo(struct iattr *attr, const struct obdo *oa, - obd_flag valid) + u32 valid) { valid &= oa->o_valid; @@ -218,7 +218,7 @@ static void iattr_from_obdo(struct iattr *attr, const struct obdo *oa, } void md_from_obdo(struct md_op_data *op_data, const struct obdo *oa, - obd_flag valid) + u32 valid) { iattr_from_obdo(&op_data->op_attr, oa, valid); if (valid & OBD_MD_FLBLOCKS) { diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c index db3fa79..947e4e4 100644 --- a/lustre/obdecho/echo.c +++ b/lustre/obdecho/echo.c @@ -104,9 +104,9 @@ static int echo_destroy_export(struct obd_export *exp) RETURN(0); } - static __u64 echo_next_id(struct obd_device *obddev) +static u64 echo_next_id(struct obd_device *obddev) { - obd_id id; + u64 id; spin_lock(&obddev->u.echo.eo_lock); id = ++obddev->u.echo.eo_lastino; @@ -173,7 +173,7 @@ static int echo_getattr(const struct lu_env *env, struct obd_export *exp, struct obd_info *oinfo) { struct obd_device *obd = class_exp2obd(exp); - obd_id id = ostid_id(&oinfo->oi_oa->o_oi); + u64 id = ostid_id(&oinfo->oi_oa->o_oi); ENTRY; if (!obd) { @@ -226,7 +226,7 @@ static int echo_setattr(const struct lu_env *env, struct obd_export *exp, } static void -echo_page_debug_setup(struct page *page, int rw, obd_id id, +echo_page_debug_setup(struct page *page, int rw, u64 id, __u64 offset, int len) { int page_offset = offset & ~CFS_PAGE_MASK; @@ -253,7 +253,7 @@ echo_page_debug_setup(struct page *page, int rw, obd_id id, } static int -echo_page_debug_check(struct page *page, obd_id id, +echo_page_debug_check(struct page *page, u64 id, __u64 offset, int len) { int page_offset = offset & ~CFS_PAGE_MASK; @@ -295,7 +295,7 @@ static int echo_map_nb_to_lb(struct obdo *oa, struct obd_ioobj *obj, (oa->o_valid & OBD_MD_FLFLAGS) != 0 && (oa->o_flags & OBD_FL_DEBUG_CHECK) != 0); struct niobuf_local *res = lb; - obd_off offset = nb->rnb_offset; + u64 offset = nb->rnb_offset; int len = nb->rnb_len; while (len > 0) { @@ -357,9 +357,9 @@ static int echo_finalize_lb(struct obdo *oa, struct obd_ioobj *obj, struct niobuf_local *lb, int verify) { struct niobuf_local *res = lb; - obd_off start = rb->rnb_offset >> PAGE_CACHE_SHIFT; - obd_off end = (rb->rnb_offset + rb->rnb_len + PAGE_CACHE_SIZE - 1) >> - PAGE_CACHE_SHIFT; + u64 start = rb->rnb_offset >> PAGE_CACHE_SHIFT; + u64 end = (rb->rnb_offset + rb->rnb_len + PAGE_CACHE_SIZE - 1) >> + PAGE_CACHE_SHIFT; int count = (int)(end - start); int rc = 0; int i; diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index f3e1053..59a82a0 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -163,7 +163,7 @@ struct echo_object_conf *cl2echo_conf(const struct cl_object_conf *c) /** @} echo_helpers */ static int cl_echo_object_put(struct echo_object *eco); -static int cl_echo_object_brw(struct echo_object *eco, int rw, obd_off offset, +static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset, struct page **pages, int npages, int async); struct echo_thread_info { @@ -1057,8 +1057,8 @@ static int cl_echo_object_put(struct echo_object *eco) } static int cl_echo_enqueue0(struct lu_env *env, struct echo_object *eco, - obd_off start, obd_off end, int mode, - __u64 *cookie , __u32 enqflags) + u64 start, u64 end, int mode, + __u64 *cookie , __u32 enqflags) { struct cl_io *io; struct cl_lock *lck; @@ -1145,7 +1145,7 @@ static void echo_commit_callback(const struct lu_env *env, struct cl_io *io, cl_page_list_add(&queue->c2_qout, page); } -static int cl_echo_object_brw(struct echo_object *eco, int rw, obd_off offset, +static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset, struct page **pages, int npages, int async) { struct lu_env *env; @@ -1243,7 +1243,7 @@ out: /** @} echo_exports */ -static obd_id last_object_id; +static u64 last_object_id; #ifdef HAVE_SERVER_SUPPORT static inline void echo_md_build_name(struct lu_name *lname, char *name, @@ -2120,14 +2120,13 @@ static void echo_put_object(struct echo_object *eco) eco->eo_dev->ed_ec->ec_exp->exp_obd->obd_name, rc); } -static void -echo_client_page_debug_setup(struct page *page, int rw, obd_id id, - obd_off offset, obd_off count) +static void echo_client_page_debug_setup(struct page *page, int rw, u64 id, + u64 offset, u64 count) { - char *addr; - obd_off stripe_off; - obd_id stripe_id; - int delta; + char *addr; + u64 stripe_off; + u64 stripe_id; + int delta; /* no partial pages on the client */ LASSERT(count == PAGE_CACHE_SIZE); @@ -2150,11 +2149,10 @@ echo_client_page_debug_setup(struct page *page, int rw, obd_id id, } static int -echo_client_page_debug_check(struct page *page, obd_id id, obd_off offset, - obd_off count) +echo_client_page_debug_check(struct page *page, u64 id, u64 offset, u64 count) { - obd_off stripe_off; - obd_id stripe_id; + u64 stripe_off; + u64 stripe_id; char *addr; int delta; int rc; @@ -2183,20 +2181,20 @@ echo_client_page_debug_check(struct page *page, obd_id id, obd_off offset, } static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa, - struct echo_object *eco, obd_off offset, - obd_size count, int async, - struct obd_trans_info *oti) + struct echo_object *eco, u64 offset, + u64 count, int async, + struct obd_trans_info *oti) { - obd_count npages; + size_t npages; struct brw_page *pga; struct brw_page *pgp; struct page **pages; - obd_off off; - int i; + u64 off; + size_t i; int rc; int verify; gfp_t gfp_mask; - int brw_flags = 0; + u32 brw_flags = 0; ENTRY; verify = (ostid_id(&oa->o_oi) != ECHO_PERSISTENT_OBJID && @@ -2207,9 +2205,8 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa, LASSERT(rw == OBD_BRW_WRITE || rw == OBD_BRW_READ); - if (count <= 0 || - (count & (~CFS_PAGE_MASK)) != 0) - RETURN(-EINVAL); + if ((count & (~CFS_PAGE_MASK)) != 0) + RETURN(-EINVAL); /* XXX think again with misaligned I/O */ npages = count >> PAGE_CACHE_SHIFT; @@ -2279,15 +2276,15 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa, static int echo_client_prep_commit(const struct lu_env *env, struct obd_export *exp, int rw, struct obdo *oa, struct echo_object *eco, - obd_off offset, obd_size count, - obd_size batch, struct obd_trans_info *oti, + u64 offset, u64 count, + u64 batch, struct obd_trans_info *oti, int async) { - struct obd_ioobj ioo; - struct niobuf_local *lnb; - struct niobuf_remote *rnb; - obd_off off; - obd_size npages, tot_pages; + struct obd_ioobj ioo; + struct niobuf_local *lnb; + struct niobuf_remote *rnb; + u64 off; + u64 npages, tot_pages; int i, ret = 0, brw_flags = 0; ENTRY; diff --git a/lustre/ofd/ofd_capa.c b/lustre/ofd/ofd_capa.c index 26c86d4..34be763 100644 --- a/lustre/ofd/ofd_capa.c +++ b/lustre/ofd/ofd_capa.c @@ -136,7 +136,7 @@ int ofd_update_capa_key(struct ofd_device *ofd, struct lustre_capa_key *new) * \retval negative number on error */ int ofd_auth_capa(struct obd_export *exp, const struct lu_fid *fid, - obd_seq seq, struct lustre_capa *capa, __u64 opc) + u64 seq, struct lustre_capa *capa, __u64 opc) { struct filter_obd *filter = &exp->exp_obd->u.filter; struct filter_capa_key *k; diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index 82bcafc..6a7dee0 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -1156,7 +1156,7 @@ static int ofd_get_info_hdl(struct tgt_session_info *tsi) RCL_CLIENT); if (KEY_IS(KEY_LAST_ID)) { - obd_id *last_id; + u64 *last_id; struct ofd_seq *oseq; req_capsule_extend(tsi->tsi_pill, &RQF_OST_GET_INFO_LAST_ID); @@ -1167,7 +1167,7 @@ static int ofd_get_info_hdl(struct tgt_session_info *tsi) last_id = req_capsule_server_get(tsi->tsi_pill, &RMF_OBD_ID); oseq = ofd_seq_load(tsi->tsi_env, ofd, - (obd_seq)exp->exp_filter_data.fed_group); + (u64)exp->exp_filter_data.fed_group); if (IS_ERR(oseq)) rc = -EFAULT; else @@ -1467,10 +1467,10 @@ static int ofd_orphans_destroy(const struct lu_env *env, struct lu_fid *fid = &info->fti_fid; struct ost_id *oi = &oa->o_oi; struct ofd_seq *oseq; - obd_seq seq = ostid_seq(oi); - obd_id end_id = ostid_id(oi); - obd_id last; - obd_id oid; + u64 seq = ostid_seq(oi); + u64 end_id = ostid_id(oi); + u64 last; + u64 oid; int skip_orphan; int rc = 0; @@ -1559,8 +1559,8 @@ static int ofd_create_hdl(struct tgt_session_info *tsi) struct obdo *rep_oa; struct obd_export *exp = tsi->tsi_exp; struct ofd_device *ofd = ofd_exp(exp); - obd_seq seq = ostid_seq(&oa->o_oi); - obd_id oid = ostid_id(&oa->o_oi); + u64 seq = ostid_seq(&oa->o_oi); + u64 oid = ostid_id(&oa->o_oi); struct ofd_seq *oseq; int rc = 0, diff; int sync_trans = 0; @@ -1684,7 +1684,7 @@ static int ofd_create_hdl(struct tgt_session_info *tsi) } if (diff > 0) { cfs_time_t enough_time = cfs_time_shift(DISK_TIMEOUT); - obd_id next_id; + u64 next_id; int created = 0; int count; @@ -1810,8 +1810,8 @@ static int ofd_destroy_hdl(struct tgt_session_info *tsi) struct ofd_device *ofd = ofd_exp(tsi->tsi_exp); struct ofd_thread_info *fti = tsi2ofd_info(tsi); struct lu_fid *fid = &fti->fti_fid; - obd_id oid; - obd_count count; + u64 oid; + u32 count; int rc = 0; ENTRY; diff --git a/lustre/ofd/ofd_fs.c b/lustre/ofd/ofd_fs.c index 66b9e39..0686a6b 100644 --- a/lustre/ofd/ofd_fs.c +++ b/lustre/ofd/ofd_fs.c @@ -81,7 +81,7 @@ int ofd_precreate_batch(struct ofd_device *ofd, int batch) * \retval pointer to the requested ofd_seq structure * \retval NULL if ofd_seq is not found */ -struct ofd_seq *ofd_seq_get(struct ofd_device *ofd, obd_seq seq) +struct ofd_seq *ofd_seq_get(struct ofd_device *ofd, u64 seq) { struct ofd_seq *oseq; @@ -161,9 +161,9 @@ static struct ofd_seq *ofd_seq_add(const struct lu_env *env, * * \retval the last object ID for this sequence */ -obd_id ofd_seq_last_oid(struct ofd_seq *oseq) +u64 ofd_seq_last_oid(struct ofd_seq *oseq) { - obd_id id; + u64 id; spin_lock(&oseq->os_last_oid_lock); id = ostid_id(&oseq->os_oi); @@ -178,7 +178,7 @@ obd_id ofd_seq_last_oid(struct ofd_seq *oseq) * \param[in] oseq OFD sequence * \param[in] id the new OID to set */ -void ofd_seq_last_oid_set(struct ofd_seq *oseq, obd_id id) +void ofd_seq_last_oid_set(struct ofd_seq *oseq, u64 id) { spin_lock(&oseq->os_last_oid_lock); if (likely(ostid_id(&oseq->os_oi) < id)) @@ -205,7 +205,7 @@ int ofd_seq_last_oid_write(const struct lu_env *env, struct ofd_device *ofd, struct ofd_seq *oseq) { struct ofd_thread_info *info = ofd_info(env); - obd_id tmp; + u64 tmp; struct dt_object *obj = oseq->os_lastid_obj; struct thandle *th; int rc; @@ -360,12 +360,12 @@ void ofd_seqs_fini(const struct lu_env *env, struct ofd_device *ofd) * \retval ERR_PTR pointer on error */ struct ofd_seq *ofd_seq_load(const struct lu_env *env, struct ofd_device *ofd, - obd_seq seq) + u64 seq) { struct ofd_thread_info *info = ofd_info(env); struct ofd_seq *oseq = NULL; struct dt_object *dob; - obd_id lastid; + u64 lastid; int rc; ENTRY; diff --git a/lustre/ofd/ofd_grant.c b/lustre/ofd/ofd_grant.c index 8471392..b2c486a 100644 --- a/lustre/ofd/ofd_grant.c +++ b/lustre/ofd/ofd_grant.c @@ -60,8 +60,8 @@ /* Clients typically hold 2x their max_rpcs_in_flight of grant space */ #define OFD_GRANT_SHRINK_LIMIT(exp) (2ULL * 8 * exp_max_brw_size(exp)) -static inline obd_size ofd_grant_from_cli(struct obd_export *exp, - struct ofd_device *ofd, obd_size val) +static inline u64 ofd_grant_from_cli(struct obd_export *exp, + struct ofd_device *ofd, u64 val) { if (ofd_grant_compat(exp, ofd)) /* clients not supporting OBD_CONNECT_GRANT_PARAM actually @@ -71,16 +71,16 @@ static inline obd_size ofd_grant_from_cli(struct obd_export *exp, return val; } -static inline obd_size ofd_grant_to_cli(struct obd_export *exp, - struct ofd_device *ofd, obd_size val) +static inline u64 ofd_grant_to_cli(struct obd_export *exp, + struct ofd_device *ofd, u64 val) { if (ofd_grant_compat(exp, ofd)) return val >> (ofd->ofd_blockbits - COMPAT_BSIZE_SHIFT); return val; } -static inline obd_size ofd_grant_chunk(struct obd_export *exp, - struct ofd_device *ofd) +static inline u64 ofd_grant_chunk(struct obd_export *exp, + struct ofd_device *ofd) { if (ofd_obd(ofd)->obd_self_export == exp) /* Grant enough space to handle a big precreate request */ @@ -112,15 +112,15 @@ static inline obd_size ofd_grant_chunk(struct obd_export *exp, */ void ofd_grant_sanity_check(struct obd_device *obd, const char *func) { - struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev); - struct obd_export *exp; - obd_size maxsize; - obd_size tot_dirty = 0; - obd_size tot_pending = 0; - obd_size tot_granted = 0; - obd_size fo_tot_granted; - obd_size fo_tot_pending; - obd_size fo_tot_dirty; + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev); + struct obd_export *exp; + u64 maxsize; + u64 tot_dirty = 0; + u64 tot_pending = 0; + u64 tot_granted = 0; + u64 fo_tot_granted; + u64 fo_tot_pending; + u64 fo_tot_dirty; if (list_empty(&obd->obd_exports)) return; @@ -254,14 +254,14 @@ static void ofd_grant_statfs(const struct lu_env *env, struct obd_export *exp, * of available space is requested * \retval amount of non-allocated space, in bytes */ -static obd_size ofd_grant_space_left(struct obd_export *exp) +static u64 ofd_grant_space_left(struct obd_export *exp) { - struct obd_device *obd = exp->exp_obd; - struct ofd_device *ofd = ofd_exp(exp); - obd_size tot_granted; - obd_size left; - obd_size avail; - obd_size unstable; + struct obd_device *obd = exp->exp_obd; + struct ofd_device *ofd = ofd_exp(exp); + u64 tot_granted; + u64 left; + u64 avail; + u64 unstable; ENTRY; assert_spin_locked(&ofd->ofd_grant_lock); @@ -298,7 +298,7 @@ static obd_size ofd_grant_space_left(struct obd_export *exp) * overhead estimate made by the OSD layer. If we grant all the free * space, we have no way (grant space cannot be revoked yet) to * adjust if the write overhead has been underestimated. */ - left -= min_t(obd_size, left, ofd_grant_reserved(ofd, avail)); + left -= min_t(u64, left, ofd_grant_reserved(ofd, avail)); /* Align left on block size */ left &= ~((1ULL << ofd->ofd_blockbits) - 1); @@ -356,7 +356,7 @@ static void ofd_grant_incoming(const struct lu_env *env, struct obd_export *exp, oa->o_dirty = 0; dirty = ofd_grant_from_cli(exp, ofd, oa->o_dirty); - dropped = ofd_grant_from_cli(exp, ofd, (obd_size)oa->o_dropped); + dropped = ofd_grant_from_cli(exp, ofd, (u64)oa->o_dropped); grant_chunk = ofd_grant_chunk(exp, ofd); /* Update our accounting now so that statfs takes it into account. @@ -408,7 +408,7 @@ static void ofd_grant_incoming(const struct lu_env *env, struct obd_export *exp, * taken out */ static void ofd_grant_shrink(struct obd_export *exp, struct obdo *oa, - obd_size left_space) + u64 left_space) { struct filter_export_data *fed; struct ofd_device *ofd = ofd_exp(exp); @@ -451,13 +451,13 @@ static void ofd_grant_shrink(struct obd_export *exp, struct obdo *oa, * \retval space (in bytes) that will be consumed to write the * network buffer */ -static inline int ofd_grant_rnb_size(struct obd_export *exp, +static inline u64 ofd_grant_rnb_size(struct obd_export *exp, struct ofd_device *ofd, struct niobuf_remote *rnb) { - obd_size blocksize; - obd_size bytes; - obd_size end; + u64 blocksize; + u64 bytes; + u64 end; if (exp && ofd_grant_compat(exp, ofd)) blocksize = 1ULL << COMPAT_BSIZE_SHIFT; @@ -473,7 +473,7 @@ static inline int ofd_grant_rnb_size(struct obd_export *exp, bytes += blocksize - end; if (exp) /* Apply per-export pecularities if one is given */ - bytes = ofd_grant_from_cli(exp, ofd, (obd_size)bytes); + bytes = ofd_grant_from_cli(exp, ofd, bytes); return bytes; } @@ -502,7 +502,7 @@ static inline int ofd_grant_rnb_size(struct obd_export *exp, */ static void ofd_grant_check(const struct lu_env *env, struct obd_export *exp, struct obdo *oa, struct niobuf_remote *rnb, - int niocount, obd_size *left) + int niocount, u64 *left) { struct filter_export_data *fed = &exp->exp_filter_data; struct obd_device *obd = exp->exp_obd; @@ -655,14 +655,14 @@ static void ofd_grant_check(const struct lu_env *env, struct obd_export *exp, * * \retval amount of grant space allocated */ -static long ofd_grant_alloc(struct obd_export *exp, obd_size curgrant, - obd_size want, obd_size left, bool conservative) +static long ofd_grant_alloc(struct obd_export *exp, u64 curgrant, + u64 want, u64 left, bool conservative) { struct obd_device *obd = exp->exp_obd; struct ofd_device *ofd = ofd_exp(exp); struct filter_export_data *fed = &exp->exp_filter_data; long grant_chunk; - obd_size grant; + u64 grant; ENTRY; @@ -753,11 +753,11 @@ static long ofd_grant_alloc(struct obd_export *exp, obd_size curgrant, * \retval amount of grant space currently owned by the client */ long ofd_grant_connect(const struct lu_env *env, struct obd_export *exp, - obd_size want, bool new_conn) + u64 want, bool new_conn) { struct ofd_device *ofd = ofd_exp(exp); struct filter_export_data *fed = &exp->exp_filter_data; - obd_size left = 0; + u64 left = 0; long grant; int from_cache; int force = 0; /* can use cached data */ @@ -785,11 +785,11 @@ refresh: } ofd_grant_alloc(exp, - ofd_grant_to_cli(exp, ofd, (obd_size)fed->fed_grant), + ofd_grant_to_cli(exp, ofd, (u64)fed->fed_grant), want, left, new_conn); /* return to client its current grant */ - grant = ofd_grant_to_cli(exp, ofd, (obd_size)fed->fed_grant); + grant = ofd_grant_to_cli(exp, ofd, (u64)fed->fed_grant); ofd->ofd_tot_granted_clients++; spin_unlock(&ofd->ofd_grant_lock); @@ -857,7 +857,7 @@ void ofd_grant_prepare_read(const struct lu_env *env, { struct ofd_device *ofd = ofd_exp(exp); int do_shrink; - obd_size left = 0; + u64 left = 0; if (!oa) return; @@ -933,7 +933,7 @@ void ofd_grant_prepare_write(const struct lu_env *env, { struct obd_device *obd = exp->exp_obd; struct ofd_device *ofd = ofd_exp(exp); - obd_size left; + u64 left; int from_cache; int force = 0; /* can use cached data intially */ int rc; @@ -1030,7 +1030,7 @@ int ofd_grant_create(const struct lu_env *env, struct obd_export *exp, int *nr) struct ofd_thread_info *info = ofd_info(env); struct ofd_device *ofd = ofd_exp(exp); struct filter_export_data *fed = &exp->exp_filter_data; - obd_size left = 0; + u64 left = 0; unsigned long wanted; ENTRY; @@ -1140,7 +1140,7 @@ void ofd_grant_commit(const struct lu_env *env, struct obd_export *exp, if (rc == 0) { spin_lock(&ofd->ofd_osfs_lock); /* Take pending out of cached statfs data */ - ofd->ofd_osfs.os_bavail -= min_t(obd_size, + ofd->ofd_osfs.os_bavail -= min_t(u64, ofd->ofd_osfs.os_bavail, pending >> ofd->ofd_blockbits); if (ofd->ofd_statfs_inflight) diff --git a/lustre/ofd/ofd_internal.h b/lustre/ofd/ofd_internal.h index 92894cb..5316264 100644 --- a/lustre/ofd/ofd_internal.h +++ b/lustre/ofd/ofd_internal.h @@ -143,24 +143,24 @@ struct ofd_device { __u64 ofd_osfs_age; int ofd_blockbits; /* writes which might be be accounted twice in ofd_osfs.os_bavail */ - obd_size ofd_osfs_unstable; + u64 ofd_osfs_unstable; /* counters used during statfs update, protected by ofd_osfs_lock. * record when some statfs refresh are in progress */ int ofd_statfs_inflight; /* track writes completed while statfs refresh is underway. * tracking is only effective when ofd_statfs_inflight > 1 */ - obd_size ofd_osfs_inflight; + u64 ofd_osfs_inflight; /* grants: all values in bytes */ /* grant lock to protect all grant counters */ spinlock_t ofd_grant_lock; /* total amount of dirty data reported by clients in incoming obdo */ - obd_size ofd_tot_dirty; + u64 ofd_tot_dirty; /* sum of filesystem space granted to clients for async writes */ - obd_size ofd_tot_granted; + u64 ofd_tot_granted; /* grant used by I/Os in progress (between prepare and commit) */ - obd_size ofd_tot_pending; + u64 ofd_tot_pending; /* free space threshold over which we stop granting space to clients * ofd_grant_ratio is stored as a fixed-point fraction using * OFD_GRANT_RATIO_SHIFT of the remaining free space, not in percentage @@ -336,7 +336,7 @@ extern void target_recovery_init(struct lu_target *lut, svc_handler_t handler); /* ofd_capa.c */ int ofd_update_capa_key(struct ofd_device *ofd, struct lustre_capa_key *key); int ofd_auth_capa(struct obd_export *exp, const struct lu_fid *fid, - obd_seq seq, struct lustre_capa *capa, __u64 opc); + u64 seq, struct lustre_capa *capa, __u64 opc); void ofd_free_capa_keys(struct ofd_device *ofd); /* ofd_dev.c */ @@ -357,12 +357,12 @@ int ofd_statfs(const struct lu_env *env, struct obd_export *exp, int ofd_obd_disconnect(struct obd_export *exp); /* ofd_fs.c */ -obd_id ofd_seq_last_oid(struct ofd_seq *oseq); -void ofd_seq_last_oid_set(struct ofd_seq *oseq, obd_id id); +u64 ofd_seq_last_oid(struct ofd_seq *oseq); +void ofd_seq_last_oid_set(struct ofd_seq *oseq, u64 id); int ofd_seq_last_oid_write(const struct lu_env *env, struct ofd_device *ofd, struct ofd_seq *oseq); int ofd_seqs_init(const struct lu_env *env, struct ofd_device *ofd); -struct ofd_seq *ofd_seq_get(struct ofd_device *ofd, obd_seq seq); +struct ofd_seq *ofd_seq_get(struct ofd_device *ofd, u64 seq); void ofd_seq_put(const struct lu_env *env, struct ofd_seq *oseq); int ofd_fs_setup(const struct lu_env *env, struct ofd_device *ofd, @@ -370,7 +370,7 @@ int ofd_fs_setup(const struct lu_env *env, struct ofd_device *ofd, void ofd_fs_cleanup(const struct lu_env *env, struct ofd_device *ofd); int ofd_precreate_batch(struct ofd_device *ofd, int batch); struct ofd_seq *ofd_seq_load(const struct lu_env *env, struct ofd_device *ofd, - obd_seq seq); + u64 seq); void ofd_seqs_fini(const struct lu_env *env, struct ofd_device *ofd); void ofd_seqs_free(const struct lu_env *env, struct ofd_device *ofd); @@ -415,7 +415,7 @@ struct ofd_object *ofd_object_find(const struct lu_env *env, const struct lu_fid *fid); int ofd_object_ff_load(const struct lu_env *env, struct ofd_object *fo); int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd, - obd_id id, struct ofd_seq *oseq, int nr, int sync); + u64 id, struct ofd_seq *oseq, int nr, int sync); void ofd_object_put(const struct lu_env *env, struct ofd_object *fo); int ofd_attr_set(const struct lu_env *env, struct ofd_object *fo, @@ -446,7 +446,7 @@ struct ofd_object *ofd_object_find_exists(const struct lu_env *env, /* ofd_grants.c */ #define OFD_GRANT_RATIO_SHIFT 8 -static inline __u64 ofd_grant_reserved(struct ofd_device *ofd, obd_size bavail) +static inline u64 ofd_grant_reserved(struct ofd_device *ofd, u64 bavail) { return (bavail * ofd->ofd_grant_ratio) >> OFD_GRANT_RATIO_SHIFT; } @@ -488,7 +488,7 @@ static inline int ofd_grant_prohibit(struct obd_export *exp, void ofd_grant_sanity_check(struct obd_device *obd, const char *func); long ofd_grant_connect(const struct lu_env *env, struct obd_export *exp, - obd_size want, bool new_conn); + u64 want, bool new_conn); void ofd_grant_discard(struct obd_export *exp); void ofd_grant_prepare_read(const struct lu_env *env, struct obd_export *exp, struct obdo *oa); diff --git a/lustre/ofd/ofd_io.c b/lustre/ofd/ofd_io.c index 714645b..1de6028 100644 --- a/lustre/ofd/ofd_io.c +++ b/lustre/ofd/ofd_io.c @@ -534,8 +534,8 @@ static int ofd_preprw_write(const struct lu_env *env, struct obd_export *exp, LASSERT(objcount == 1); if (unlikely(exp->exp_obd->obd_recovering)) { - obd_seq seq = fid_seq(fid); - obd_id oid = fid_oid(fid); + u64 seq = fid_seq(fid); + u64 oid = fid_oid(fid); struct ofd_seq *oseq; oseq = ofd_seq_load(env, ofd, seq); @@ -569,7 +569,7 @@ static int ofd_preprw_write(const struct lu_env *env, struct obd_export *exp, } while (diff > 0) { - obd_id next_id = ofd_seq_last_oid(oseq) + 1; + u64 next_id = ofd_seq_last_oid(oseq) + 1; int count = ofd_precreate_batch(ofd, diff); rc = ofd_precreate_objects(env, ofd, next_id, diff --git a/lustre/ofd/ofd_obd.c b/lustre/ofd/ofd_obd.c index ede28dc..8a29649 100644 --- a/lustre/ofd/ofd_obd.c +++ b/lustre/ofd/ofd_obd.c @@ -711,7 +711,7 @@ int ofd_statfs_internal(const struct lu_env *env, struct ofd_device *ofd, spin_lock(&ofd->ofd_osfs_lock); if (cfs_time_before_64(ofd->ofd_osfs_age, max_age) || max_age == 0) { - obd_size unstable; + u64 unstable; /* statfs data are too old, get up-to-date one. * we must be cautious here since multiple threads might be @@ -747,7 +747,7 @@ int ofd_statfs_internal(const struct lu_env *env, struct ofd_device *ofd, * w/o the ofd_osfs_lock. Those ones got added to * the cached statfs data that we are about to crunch. * Take them into account in the new statfs data */ - osfs->os_bavail -= min_t(obd_size, osfs->os_bavail, + osfs->os_bavail -= min_t(u64, osfs->os_bavail, unstable >> ofd->ofd_blockbits); /* However, we don't really know if those writes got * accounted in the statfs call, so tell @@ -834,7 +834,7 @@ int ofd_statfs(const struct lu_env *env, struct obd_export *exp, osfs->os_bfree << ofd->ofd_blockbits, osfs->os_bavail << ofd->ofd_blockbits); - osfs->os_bavail -= min_t(obd_size, osfs->os_bavail, + osfs->os_bavail -= min_t(u64, osfs->os_bavail, ((ofd->ofd_tot_dirty + ofd->ofd_tot_pending + osfs->os_bsize - 1) >> ofd->ofd_blockbits)); @@ -844,7 +844,7 @@ int ofd_statfs(const struct lu_env *env, struct obd_export *exp, struct filter_export_data *fed; fed = &obd->obd_self_export->exp_filter_data; - osfs->os_bavail -= min_t(obd_size, osfs->os_bavail, + osfs->os_bavail -= min_t(u64, osfs->os_bavail, fed->fed_grant >> ofd->ofd_blockbits); } @@ -1101,10 +1101,10 @@ static int ofd_echo_create(const struct lu_env *env, struct obd_export *exp, { struct ofd_device *ofd = ofd_exp(exp); struct ofd_thread_info *info; - obd_seq seq = ostid_seq(&oa->o_oi); + u64 seq = ostid_seq(&oa->o_oi); struct ofd_seq *oseq; int rc = 0, diff = 1; - obd_id next_id; + u64 next_id; int count; ENTRY; diff --git a/lustre/ofd/ofd_objects.c b/lustre/ofd/ofd_objects.c index eea06e7..3aa18f5 100644 --- a/lustre/ofd/ofd_objects.c +++ b/lustre/ofd/ofd_objects.c @@ -205,7 +205,7 @@ void ofd_object_put(const struct lu_env *env, struct ofd_object *fo) * \retval negative value on error */ int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd, - obd_id id, struct ofd_seq *oseq, int nr, int sync) + u64 id, struct ofd_seq *oseq, int nr, int sync) { struct ofd_thread_info *info = ofd_info(env); struct ofd_object *fo = NULL; @@ -213,7 +213,7 @@ int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd, struct thandle *th; struct ofd_object **batch; struct lu_fid *fid = &info->fti_fid; - obd_id tmp; + u64 tmp; int rc; int i; int objects = 0; -- 1.8.3.1