static int out_create(struct tgt_session_info *tsi)
{
- struct tgt_thread_info *tti = tgt_th_info(tsi->tsi_env);
- struct object_update *update = tti->tti_u.update.tti_update;
- struct dt_object *obj = tti->tti_u.update.tti_dt_object;
- struct dt_object_format *dof = &tti->tti_u.update.tti_update_dof;
- struct obdo *lobdo = &tti->tti_u.update.tti_obdo;
- struct lu_attr *attr = &tti->tti_attr;
- struct lu_fid *fid = NULL;
- struct obdo *wobdo;
- size_t size;
- int rc;
+ struct tgt_thread_info *tti = tgt_th_info(tsi->tsi_env);
+ struct object_update *update = tti->tti_u.update.tti_update;
+ struct dt_object *obj = tti->tti_u.update.tti_dt_object;
+ struct dt_object_format *dof = &tti->tti_u.update.tti_update_dof;
+ struct obdo *lobdo = &tti->tti_u.update.tti_obdo;
+ struct lu_attr *attr = &tti->tti_attr;
+ struct lu_fid *fid = NULL;
+ struct obdo *wobdo;
+ size_t size;
+ int rc;
ENTRY;
- wobdo = object_update_param_get(update, 0, &size);
+ size = sizeof(*wobdo);
+ wobdo = object_update_param_get(update, 0, &size,
+ tgt_name(tsi->tsi_tgt), "obdo");
if (IS_ERR(wobdo)) {
rc = PTR_ERR(wobdo);
CERROR("%s: obdo is NULL, invalid RPC: rc = %d\n",
tgt_name(tsi->tsi_tgt), rc);
RETURN(rc);
}
- if (size != sizeof(*wobdo)) {
- rc = -EPROTO;
- CERROR("%s: wrong size for obdo %zu != %zu, invalid RPC: rc = %d\n",
- tgt_name(tsi->tsi_tgt), size, sizeof(*wobdo), rc);
- RETURN(rc);
- }
if (req_capsule_req_need_swab(tsi->tsi_pill))
lustre_swab_obdo(wobdo);
dof->dof_type = dt_mode_to_dft(attr->la_mode);
if (update->ou_params_count > 1) {
- fid = object_update_param_get(update, 1, &size);
+ size = sizeof(*fid);
+ fid = object_update_param_get(update, 1, &size,
+ tgt_name(tsi->tsi_tgt), "lu_fid");
if (IS_ERR(fid)) {
rc = PTR_ERR(fid);
CERROR("%s: invalid fid: rc = %d\n",
tgt_name(tsi->tsi_tgt), rc);
RETURN(rc);
}
- if (size != sizeof(*fid)) {
- rc = -EPROTO;
- CERROR("%s: wrong size for fid %zu != %zu: rc = %d\n",
- tgt_name(tsi->tsi_tgt), size, sizeof(*fid), rc);
- RETURN(rc);
- }
if (req_capsule_req_need_swab(tsi->tsi_pill))
lustre_swab_lu_fid(fid);
if (!fid_is_sane(fid)) {
static int out_attr_set(struct tgt_session_info *tsi)
{
- struct tgt_thread_info *tti = tgt_th_info(tsi->tsi_env);
- struct object_update *update = tti->tti_u.update.tti_update;
- struct lu_attr *attr = &tti->tti_attr;
- struct dt_object *obj = tti->tti_u.update.tti_dt_object;
- struct obdo *lobdo = &tti->tti_u.update.tti_obdo;
- struct obdo *wobdo;
- size_t size;
- int rc;
+ struct tgt_thread_info *tti = tgt_th_info(tsi->tsi_env);
+ struct object_update *update = tti->tti_u.update.tti_update;
+ struct lu_attr *attr = &tti->tti_attr;
+ struct dt_object *obj = tti->tti_u.update.tti_dt_object;
+ struct obdo *lobdo = &tti->tti_u.update.tti_obdo;
+ struct obdo *wobdo;
+ size_t size;
+ int rc;
ENTRY;
- wobdo = object_update_param_get(update, 0, &size);
+ size = sizeof(*wobdo);
+ wobdo = object_update_param_get(update, 0, &size,
+ tgt_name(tsi->tsi_tgt), "obdo");
if (IS_ERR(wobdo)) {
rc = PTR_ERR(wobdo);
CERROR("%s: empty obdo in the update: rc = %d\n",
tgt_name(tsi->tsi_tgt), rc);
RETURN(rc);
}
- if (size != sizeof(*wobdo)) {
- rc = -EPROTO;
- CERROR("%s: wrong size for obdo %zu != %zu in the update: rc = %d\n",
- tgt_name(tsi->tsi_tgt), size, sizeof(*wobdo), rc);
- RETURN(rc);
- }
attr->la_valid = 0;
attr->la_valid = 0;
static int out_attr_get(struct tgt_session_info *tsi)
{
- const struct lu_env *env = tsi->tsi_env;
- struct tgt_thread_info *tti = tgt_th_info(env);
- struct object_update *update = tti->tti_u.update.tti_update;
- struct obdo *obdo = &tti->tti_u.update.tti_obdo;
- struct lu_attr *la = &tti->tti_attr;
- struct dt_object *obj = tti->tti_u.update.tti_dt_object;
- int idx = tti->tti_u.update.tti_update_reply_index;
- int rc;
+ const struct lu_env *env = tsi->tsi_env;
+ struct tgt_thread_info *tti = tgt_th_info(env);
+ struct object_update *update = tti->tti_u.update.tti_update;
+ struct obdo *obdo = &tti->tti_u.update.tti_obdo;
+ struct lu_attr *la = &tti->tti_attr;
+ struct dt_object *obj = tti->tti_u.update.tti_dt_object;
+ int idx = tti->tti_u.update.tti_update_reply_index;
+ int rc;
ENTRY;
static int out_xattr_get(struct tgt_session_info *tsi)
{
- const struct lu_env *env = tsi->tsi_env;
- struct tgt_thread_info *tti = tgt_th_info(env);
- struct object_update *update = tti->tti_u.update.tti_update;
- struct lu_buf *lbuf = &tti->tti_buf;
+ const struct lu_env *env = tsi->tsi_env;
+ struct tgt_thread_info *tti = tgt_th_info(env);
+ struct object_update *update = tti->tti_u.update.tti_update;
+ struct lu_buf *lbuf = &tti->tti_buf;
struct object_update_reply *reply = tti->tti_u.update.tti_update_reply;
- struct dt_object *obj = tti->tti_u.update.tti_dt_object;
- char *name;
+ struct dt_object *obj = tti->tti_u.update.tti_dt_object;
+ char *name;
struct object_update_result *update_result;
- int idx = tti->tti_u.update.tti_update_reply_index;
- int rc;
+ int idx = tti->tti_u.update.tti_update_reply_index;
+ int rc;
ENTRY;
RETURN(-ENOENT);
}
- name = object_update_param_get(update, 0, NULL);
+ name = object_update_param_get(update, 0, NULL, NULL, NULL);
if (IS_ERR(name)) {
CERROR("%s: empty name for xattr get: rc = %ld\n",
tgt_name(tsi->tsi_tgt), PTR_ERR(name));
static int out_index_lookup(struct tgt_session_info *tsi)
{
- const struct lu_env *env = tsi->tsi_env;
- struct tgt_thread_info *tti = tgt_th_info(env);
- struct object_update *update = tti->tti_u.update.tti_update;
- struct dt_object *obj = tti->tti_u.update.tti_dt_object;
- char *name;
- int rc;
+ const struct lu_env *env = tsi->tsi_env;
+ struct tgt_thread_info *tti = tgt_th_info(env);
+ struct object_update *update = tti->tti_u.update.tti_update;
+ struct dt_object *obj = tti->tti_u.update.tti_dt_object;
+ char *name;
+ int rc;
ENTRY;
if (!lu_object_exists(&obj->do_lu))
RETURN(-ENOENT);
- name = object_update_param_get(update, 0, NULL);
+ name = object_update_param_get(update, 0, NULL, NULL, NULL);
if (IS_ERR(name)) {
CERROR("%s: empty name for lookup: rc = %ld\n",
tgt_name(tsi->tsi_tgt), PTR_ERR(name));
static int out_xattr_set(struct tgt_session_info *tsi)
{
- struct tgt_thread_info *tti = tgt_th_info(tsi->tsi_env);
- struct object_update *update = tti->tti_u.update.tti_update;
- struct dt_object *obj = tti->tti_u.update.tti_dt_object;
- struct lu_buf *lbuf = &tti->tti_buf;
- char *name;
- char *buf;
- __u32 *tmp;
- size_t buf_len = 0;
- int flag;
- size_t size = 0;
- int rc;
+ struct tgt_thread_info *tti = tgt_th_info(tsi->tsi_env);
+ struct object_update *update = tti->tti_u.update.tti_update;
+ struct dt_object *obj = tti->tti_u.update.tti_dt_object;
+ struct lu_buf *lbuf = &tti->tti_buf;
+ char *name;
+ char *buf;
+ __u32 *tmp;
+ size_t buf_len = 0;
+ int flag;
+ size_t size = 0;
+ int rc;
ENTRY;
- name = object_update_param_get(update, 0, NULL);
+ name = object_update_param_get(update, 0, NULL, NULL, NULL);
if (IS_ERR(name)) {
CERROR("%s: empty name for xattr set: rc = %ld\n",
tgt_name(tsi->tsi_tgt), PTR_ERR(name));
}
/* If buffer == NULL (-ENODATA), then it might mean delete xattr */
- buf = object_update_param_get(update, 1, &buf_len);
+ buf = object_update_param_get(update, 1, &buf_len,
+ tgt_name(tsi->tsi_tgt), "char");
if (IS_ERR(buf) && PTR_ERR(buf) != -ENODATA)
RETURN(PTR_ERR(buf));
lbuf->lb_buf = buf;
lbuf->lb_len = buf_len;
- tmp = object_update_param_get(update, 2, &size);
+ size = sizeof(*tmp);
+ tmp = object_update_param_get(update, 2, &size,
+ tgt_name(tsi->tsi_tgt), "__u32");
if (IS_ERR(tmp)) {
rc = PTR_ERR(tmp);
CERROR("%s: emptry flag: rc = %d\n",
tgt_name(tsi->tsi_tgt), rc);
RETURN(rc);
}
- if (size != sizeof(*tmp)) {
- rc = -EPROTO;
- CERROR("%s: wrong size for flag %zu != %zu: rc = %d\n",
- tgt_name(tsi->tsi_tgt), size, sizeof(*tmp), rc);
- RETURN(rc);
- }
if (req_capsule_req_need_swab(tsi->tsi_pill))
__swab32s(tmp);
int rc;
ENTRY;
- name = object_update_param_get(update, 0, NULL);
+ name = object_update_param_get(update, 0, NULL, NULL, NULL);
if (IS_ERR(name)) {
CERROR("%s: empty name for xattr set: rc = %ld\n",
tgt_name(tsi->tsi_tgt), PTR_ERR(name));
static int out_index_insert(struct tgt_session_info *tsi)
{
- struct tgt_thread_info *tti = tgt_th_info(tsi->tsi_env);
- struct object_update *update = tti->tti_u.update.tti_update;
- struct dt_object *obj = tti->tti_u.update.tti_dt_object;
- struct dt_insert_rec *rec = &tti->tti_rec;
- struct lu_fid *fid;
- char *name;
- __u32 *ptype;
- int rc = 0;
- size_t size;
+ struct tgt_thread_info *tti = tgt_th_info(tsi->tsi_env);
+ struct object_update *update = tti->tti_u.update.tti_update;
+ struct dt_object *obj = tti->tti_u.update.tti_dt_object;
+ struct dt_insert_rec *rec = &tti->tti_rec;
+ struct lu_fid *fid;
+ char *name;
+ __u32 *ptype;
+ int rc = 0;
+ size_t size;
ENTRY;
- name = object_update_param_get(update, 0, NULL);
+ name = object_update_param_get(update, 0, NULL, NULL, NULL);
if (IS_ERR(name)) {
CERROR("%s: empty name for index insert: rc = %ld\n",
tgt_name(tsi->tsi_tgt), PTR_ERR(name));
RETURN(PTR_ERR(name));
}
- fid = object_update_param_get(update, 1, &size);
+ size = sizeof(*fid);
+ fid = object_update_param_get(update, 1, &size,
+ tgt_name(tsi->tsi_tgt), "lu_fid");
if (IS_ERR(fid)) {
rc = PTR_ERR(fid);
CERROR("%s: invalid fid: rc = %d\n",
tgt_name(tsi->tsi_tgt), rc);
RETURN(rc);
}
- if (size != sizeof(*fid)) {
- rc = -EPROTO;
- CERROR("%s: wrong size for fid %zu != %zu: rc = %d\n",
- tgt_name(tsi->tsi_tgt), size, sizeof(*fid), rc);
- RETURN(rc);
- }
if (req_capsule_req_need_swab(tsi->tsi_pill))
lustre_swab_lu_fid(fid);
RETURN(-EPROTO);
}
- ptype = object_update_param_get(update, 2, &size);
+ size = sizeof(*ptype);
+ ptype = object_update_param_get(update, 2, &size,
+ tgt_name(tsi->tsi_tgt), "__u32");
if (IS_ERR(ptype)) {
rc = PTR_ERR(ptype);
CERROR("%s: invalid type for index insert: rc = %d\n",
tgt_name(tsi->tsi_tgt), rc);
RETURN(rc);
}
- if (size != sizeof(*ptype)) {
- rc = -EPROTO;
- CERROR("%s: wrong size for index insert %zu != %zu: rc = %d\n",
- tgt_name(tsi->tsi_tgt), size, sizeof(*ptype), rc);
- RETURN(rc);
- }
if (req_capsule_req_need_swab(tsi->tsi_pill))
__swab32s(ptype);
static int out_index_delete(struct tgt_session_info *tsi)
{
- struct tgt_thread_info *tti = tgt_th_info(tsi->tsi_env);
- struct object_update *update = tti->tti_u.update.tti_update;
- struct dt_object *obj = tti->tti_u.update.tti_dt_object;
- char *name;
- int rc = 0;
+ struct tgt_thread_info *tti = tgt_th_info(tsi->tsi_env);
+ struct object_update *update = tti->tti_u.update.tti_update;
+ struct dt_object *obj = tti->tti_u.update.tti_dt_object;
+ char *name;
+ int rc = 0;
if (!lu_object_exists(&obj->do_lu))
RETURN(-ENOENT);
- name = object_update_param_get(update, 0, NULL);
+ name = object_update_param_get(update, 0, NULL, NULL, NULL);
if (IS_ERR(name)) {
CERROR("%s: empty name for index delete: rc = %ld\n",
tgt_name(tsi->tsi_tgt), PTR_ERR(name));
static int out_destroy(struct tgt_session_info *tsi)
{
- struct tgt_thread_info *tti = tgt_th_info(tsi->tsi_env);
- struct object_update *update = tti->tti_u.update.tti_update;
- struct dt_object *obj = tti->tti_u.update.tti_dt_object;
- struct lu_fid *fid;
- int rc;
+ struct tgt_thread_info *tti = tgt_th_info(tsi->tsi_env);
+ struct object_update *update = tti->tti_u.update.tti_update;
+ struct dt_object *obj = tti->tti_u.update.tti_dt_object;
+ struct lu_fid *fid;
+ int rc;
ENTRY;
fid = &update->ou_fid;
static int out_write(struct tgt_session_info *tsi)
{
- struct tgt_thread_info *tti = tgt_th_info(tsi->tsi_env);
- struct object_update *update = tti->tti_u.update.tti_update;
- struct dt_object *obj = tti->tti_u.update.tti_dt_object;
- struct lu_buf *lbuf = &tti->tti_buf;
- char *buf;
- __u64 *tmp;
- size_t size = 0;
- size_t buf_len = 0;
- loff_t pos;
- int rc;
+ struct tgt_thread_info *tti = tgt_th_info(tsi->tsi_env);
+ struct object_update *update = tti->tti_u.update.tti_update;
+ struct dt_object *obj = tti->tti_u.update.tti_dt_object;
+ struct lu_buf *lbuf = &tti->tti_buf;
+ char *buf;
+ __u64 *tmp;
+ size_t size = 0;
+ size_t buf_len = 0;
+ loff_t pos;
+ int rc;
ENTRY;
- buf = object_update_param_get(update, 0, &buf_len);
+ buf = object_update_param_get(update, 0, &buf_len,
+ tgt_name(tsi->tsi_tgt), "char");
if (IS_ERR(buf)) {
rc = PTR_ERR(buf);
CERROR("%s: empty buf for xattr set: rc = %d\n",
tgt_name(tsi->tsi_tgt), rc);
RETURN(rc);
}
- if (buf_len == 0) {
- rc = -EPROTO;
- CERROR("%s: wrong buf_len %zu != 0 for xattr set: rc = %d\n",
- tgt_name(tsi->tsi_tgt), buf_len, rc);
- RETURN(rc);
- }
lbuf->lb_buf = buf;
lbuf->lb_len = buf_len;
- tmp = object_update_param_get(update, 1, &size);
+ size = sizeof(*tmp);
+ tmp = object_update_param_get(update, 1, &size,
+ tgt_name(tsi->tsi_tgt), "__u64");
if (IS_ERR(tmp)) {
rc = PTR_ERR(tmp);
CERROR("%s: empty pos: rc = %d\n",
tgt_name(tsi->tsi_tgt), rc);
RETURN(rc);
}
- if (size != sizeof(*tmp)) {
- rc = -EPROTO;
- CERROR("%s: wrong size for pos %zu != %zu: rc = %d\n",
- tgt_name(tsi->tsi_tgt), size, sizeof(*tmp), rc);
- RETURN(rc);
- }
if (req_capsule_req_need_swab(tsi->tsi_pill))
__swab64s(tmp);
static int out_read(struct tgt_session_info *tsi)
{
- const struct lu_env *env = tsi->tsi_env;
- struct tgt_thread_info *tti = tgt_th_info(env);
- struct object_update *update = tti->tti_u.update.tti_update;
- struct dt_object *obj = tti->tti_u.update.tti_dt_object;
+ const struct lu_env *env = tsi->tsi_env;
+ struct tgt_thread_info *tti = tgt_th_info(env);
+ struct object_update *update = tti->tti_u.update.tti_update;
+ struct dt_object *obj = tti->tti_u.update.tti_dt_object;
struct object_update_reply *reply = tti->tti_u.update.tti_update_reply;
int index = tti->tti_u.update.tti_update_reply_index;
- struct lu_rdbuf *rdbuf;
+ struct lu_rdbuf *rdbuf;
struct object_update_result *update_result;
- struct out_read_reply *orr;
+ struct out_read_reply *orr;
void *tmp;
size_t size;
size_t total_size = 0;
if (!lu_object_exists(&obj->do_lu))
GOTO(out, rc = -ENOENT);
- tmp = object_update_param_get(update, 0, NULL);
+ tmp = object_update_param_get(update, 0, NULL, NULL, NULL);
if (IS_ERR(tmp)) {
CERROR("%s: empty size for read: rc = %ld\n",
tgt_name(tsi->tsi_tgt), PTR_ERR(tmp));
}
size = le64_to_cpu(*(size_t *)(tmp));
- tmp = object_update_param_get(update, 1, NULL);
+ tmp = object_update_param_get(update, 1, NULL, NULL, NULL);
if (IS_ERR(tmp)) {
CERROR("%s: empty pos for read: rc = %ld\n",
tgt_name(tsi->tsi_tgt), PTR_ERR(tmp));
int declare_ret)
{
struct tgt_session_info *tsi = tgt_ses_info(env);
- int i;
- int rc;
- int rc1;
+ int i;
+ int rc;
+ int rc1;
ENTRY;
if (ta->ta_handle == NULL)
*/
int out_handle(struct tgt_session_info *tsi)
{
- const struct lu_env *env = tsi->tsi_env;
- struct tgt_thread_info *tti = tgt_th_info(env);
- struct thandle_exec_args *ta = &tti->tti_tea;
- struct req_capsule *pill = tsi->tsi_pill;
- struct dt_device *dt = tsi->tsi_tgt->lut_bottom;
- struct out_update_header *ouh;
- struct out_update_buffer *oub = NULL;
- struct object_update *update;
- struct object_update_reply *reply;
- struct ptlrpc_bulk_desc *desc = NULL;
+ const struct lu_env *env = tsi->tsi_env;
+ struct tgt_thread_info *tti = tgt_th_info(env);
+ struct thandle_exec_args *ta = &tti->tti_tea;
+ struct req_capsule *pill = tsi->tsi_pill;
+ struct dt_device *dt = tsi->tsi_tgt->lut_bottom;
+ struct out_update_header *ouh;
+ struct out_update_buffer *oub = NULL;
+ struct object_update *update;
+ struct object_update_reply *reply;
+ struct ptlrpc_bulk_desc *desc = NULL;
struct tg_reply_data *trd = NULL;
- void **update_bufs;
- int current_batchid = -1;
- __u32 update_buf_count;
- unsigned int i;
- unsigned int reply_index = 0;
- int rc = 0;
- int rc1 = 0;
- int ouh_size, reply_size;
- int updates;
+ void **update_bufs;
+ int current_batchid = -1;
+ __u32 update_buf_count;
+ unsigned int i;
+ unsigned int reply_index = 0;
+ int rc = 0;
+ int rc1 = 0;
+ int ouh_size, reply_size;
+ int updates;
bool need_reconstruct;
ENTRY;
/* Walk through updates in the request to execute them */
for (i = 0; i < update_buf_count; i++) {
- struct tgt_handler *h;
- struct dt_object *dt_obj;
- int update_count;
+ struct tgt_handler *h;
+ struct dt_object *dt_obj;
+ int update_count;
struct object_update_request *our;
- int j;
+ int j;
our = update_bufs[i];
update_count = our->ourq_count;