@@ -2162,7 +2162,7 @@ static inline int cl_object_same(struct cl_object *o0, struct cl_object *o1)
static inline void cl_object_page_init(struct cl_object *clob, int size)
{
clob->co_slice_off = cl_object_header(clob)->coh_page_bufsize;
- cl_object_header(clob)->coh_page_bufsize += cfs_size_round(size);
+ cl_object_header(clob)->coh_page_bufsize += round_up(size, 8);
WARN_ON(cl_object_header(clob)->coh_page_bufsize > 512);
}
@@ -316,7 +316,7 @@ struct lu_object *vvp_object_alloc(const struct lu_env *env,
obj = &vob->vob_cl.co_lu;
hdr = &vob->vob_header;
cl_object_header_init(hdr);
- hdr->coh_page_bufsize = cfs_size_round(sizeof(struct cl_page));
+ hdr->coh_page_bufsize = round_up(sizeof(struct cl_page), 8);
lu_object_init(obj, &hdr->coh_lu, dev);
lu_object_add_top(&hdr->coh_lu, obj);
@@ -1712,15 +1712,14 @@ static int mdc_ioc_fid2path(struct obd_export *exp, struct getinfo_fid2path *gf)
return -EOVERFLOW;
/* Key is KEY_FID2PATH + getinfo_fid2path description */
- keylen = cfs_size_round(sizeof(KEY_FID2PATH)) + sizeof(*gf) +
- sizeof(struct lu_fid);
+ keylen = round_up(sizeof(KEY_FID2PATH) + sizeof(*gf) +
+ sizeof(struct lu_fid), 8);
key = kzalloc(keylen, GFP_NOFS);
if (!key)
return -ENOMEM;
memcpy(key, KEY_FID2PATH, sizeof(KEY_FID2PATH));
- memcpy(key + cfs_size_round(sizeof(KEY_FID2PATH)), gf, sizeof(*gf));
-
- memcpy(key + cfs_size_round(sizeof(KEY_FID2PATH)) + sizeof(*gf),
+ memcpy(key + round_up(sizeof(KEY_FID2PATH), 8), gf, sizeof(*gf));
+ memcpy(key + round_up(sizeof(KEY_FID2PATH), 8) + sizeof(*gf),
gf->gf_root_fid, sizeof(struct lu_fid));
CDEBUG(D_IOCTL, "path get " DFID " from %llu #%d\n",
PFID(&gf->gf_fid), gf->gf_recno, gf->gf_linkno);
@@ -278,17 +278,17 @@ int obd_ioctl_getdata(struct obd_ioctl_data **datap, int *len, void __user *arg)
if (data->ioc_inllen1) {
data->ioc_inlbuf1 = &data->ioc_bulk[0];
- offset += cfs_size_round(data->ioc_inllen1);
+ offset += round_up(data->ioc_inllen1, 8);
}
if (data->ioc_inllen2) {
data->ioc_inlbuf2 = &data->ioc_bulk[0] + offset;
- offset += cfs_size_round(data->ioc_inllen2);
+ offset += round_up(data->ioc_inllen2, 8);
}
if (data->ioc_inllen3) {
data->ioc_inlbuf3 = &data->ioc_bulk[0] + offset;
- offset += cfs_size_round(data->ioc_inllen3);
+ offset += round_up(data->ioc_inllen3, 8);
}
if (data->ioc_inllen4)
@@ -294,7 +294,7 @@ static struct lu_object *echo_object_alloc(const struct lu_env *env,
obj = &echo_obj2cl(eco)->co_lu;
cl_object_header_init(hdr);
- hdr->coh_page_bufsize = cfs_size_round(sizeof(struct cl_page));
+ hdr->coh_page_bufsize = round_up(sizeof(struct cl_page), 8);
lu_object_init(obj, &hdr->coh_lu, dev);
lu_object_add_top(&hdr->coh_lu, obj);
@@ -2302,7 +2302,7 @@ int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops,
struct osc_async_page *oap = &ops->ops_oap;
if (!page)
- return cfs_size_round(sizeof(*oap));
+ return round_up(sizeof(*oap), 8);
oap->oap_obj = osc;
oap->oap_page = page->cp_vmpage;
@@ -132,14 +132,12 @@ static int batch_prep_update_req(struct batch_update_head *head,
struct batch_update_buffer *buf;
struct but_update_header *buh;
struct but_update_buffer *bub;
+ int repsize = head->buh_repsize;
int page_count = 0;
int total = 0;
- int repsize;
int rc;
- repsize = head->buh_repsize +
- cfs_size_round(offsetof(struct batch_update_reply,
- burp_repmsg[0]));
+ repsize += round_up(offsetof(struct batch_update_reply, burp_repmsg[0]), 8);
if (repsize < OUT_UPDATE_REPLY_SIZE)
repsize = OUT_UPDATE_REPLY_SIZE;
@@ -2404,9 +2404,11 @@ u32 req_capsule_fmt_size(u32 magic, const struct req_format *fmt,
if (!size)
return size;
- for (; i < fmt->rf_fields[loc].nr; ++i)
- if (fmt->rf_fields[loc].d[i]->rmf_size != -1)
- size += cfs_size_round(fmt->rf_fields[loc].d[i]->rmf_size);
+ for (; i < fmt->rf_fields[loc].nr; ++i) {
+ if (fmt->rf_fields[loc].d[i]->rmf_size == -1)
+ continue;
+ size += round_up(fmt->rf_fields[loc].d[i]->rmf_size, 8);
+ }
return size;
}
EXPORT_SYMBOL(req_capsule_fmt_size);
@@ -55,8 +55,7 @@
static inline u32 lustre_msg_hdr_size_v2(u32 count)
{
- return cfs_size_round(offsetof(struct lustre_msg_v2,
- lm_buflens[count]));
+ return round_up(offsetof(struct lustre_msg_v2, lm_buflens[count]), 8);
}
u32 lustre_msg_hdr_size(u32 magic, u32 count)
@@ -91,7 +90,7 @@ u32 lustre_msg_size_v2(int count, u32 *lengths)
LASSERT(count > 0);
size = lustre_msg_hdr_size_v2(count);
for (i = 0; i < count; i++)
- size += cfs_size_round(lengths[i]);
+ size += round_up(lengths[i], 8);
return size;
}
@@ -164,7 +163,7 @@ void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, u32 *lens,
if (tmp)
memcpy(ptr, tmp, lens[i]);
- ptr += cfs_size_round(lens[i]);
+ ptr += round_up(lens[i], 8);
}
}
EXPORT_SYMBOL(lustre_init_msg_v2);
@@ -376,7 +375,7 @@ void *lustre_msg_buf_v2(struct lustre_msg_v2 *m, u32 n, u32 min_size)
offset = lustre_msg_hdr_size_v2(bufcount);
for (i = 0; i < n; i++)
- offset += cfs_size_round(m->lm_buflens[i]);
+ offset += round_up(m->lm_buflens[i], 8);
return (char *)m + offset;
}
@@ -410,7 +409,7 @@ static int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, u32 segment,
if (move_data && msg->lm_bufcount > segment + 1) {
tail = lustre_msg_buf_v2(msg, segment + 1, 0);
for (n = segment + 1; n < msg->lm_bufcount; n++)
- tail_len += cfs_size_round(msg->lm_buflens[n]);
+ tail_len += round_up(msg->lm_buflens[n], 8);
}
msg->lm_buflens[segment] = newlen;
@@ -562,7 +561,7 @@ static int lustre_unpack_msg_v2(struct lustre_msg_v2 *m, int len)
for (i = 0; i < m->lm_bufcount; i++) {
if (swabbed)
__swab32s(&m->lm_buflens[i]);
- buflen = cfs_size_round(m->lm_buflens[i]);
+ buflen = round_up(m->lm_buflens[i], 8);
if (buflen < 0 || buflen > PTLRPC_MAX_BUFLEN) {
CERROR("buffer %d length %d is not valid\n", i, buflen);
return -EINVAL;
@@ -139,13 +139,9 @@ do { \
/* logical equivalence */
#define equi(a, b) (!!(a) == !!(b))
-#ifndef HAVE_CFS_SIZE_ROUND
static inline size_t cfs_size_round(int val)
{
return round_up(val, 8);
}
-#define HAVE_CFS_SIZE_ROUND
-#endif
-
#endif
@@ -72,8 +72,8 @@ static inline size_t libcfs_ioctl_packlen(struct libcfs_ioctl_data *data)
{
size_t len = sizeof(*data);
- len += cfs_size_round(data->ioc_inllen1);
- len += cfs_size_round(data->ioc_inllen2);
+ len += round_up(data->ioc_inllen1, 8);
+ len += round_up(data->ioc_inllen2, 8);
return len;
}
@@ -124,7 +124,7 @@ static inline bool libcfs_ioctl_is_invalid(struct libcfs_ioctl_data *data)
return true;
}
if (data->ioc_inllen2 &&
- data->ioc_bulk[cfs_size_round(data->ioc_inllen1) +
+ data->ioc_bulk[round_up(data->ioc_inllen1, 8) +
data->ioc_inllen2 - 1] != '\0') {
CERROR("LIBCFS ioctl: inlbuf2 not 0 terminated\n");
return true;
@@ -144,7 +144,7 @@ static int libcfs_ioctl_data_adjust(struct libcfs_ioctl_data *data)
if (data->ioc_inllen2)
data->ioc_inlbuf2 = &data->ioc_bulk[0] +
- cfs_size_round(data->ioc_inllen1);
+ round_up(data->ioc_inllen1, 8);
return 0;
}