This patch fixes issues reported by checkpatch
for file lustre/osd-zfs/osd_xattr.c
Test-Parameters: trivial
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: I446e990ba4865943d17087beaf8e53082bae9131
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54256
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
int __osd_xattr_load(struct osd_device *osd, sa_handle_t *hdl, nvlist_t **sa)
{
int __osd_xattr_load(struct osd_device *osd, sa_handle_t *hdl, nvlist_t **sa)
{
- char *buf;
- int rc, size;
+ char *buf;
+ int rc, size;
rc = -sa_size(hdl, SA_ZPL_DXATTR(osd), &size);
if (rc) {
rc = -sa_size(hdl, SA_ZPL_DXATTR(osd), &size);
if (rc) {
const struct lu_buf *buf, const char *name, int *sizep)
{
uchar_t *nv_value;
const struct lu_buf *buf, const char *name, int *sizep)
{
uchar_t *nv_value;
rc = __osd_xattr_cache(obj);
if (rc)
rc = __osd_xattr_cache(obj);
if (rc)
uint64_t xattr, struct lu_buf *buf,
const char *name, int *sizep)
{
uint64_t xattr, struct lu_buf *buf,
const char *name, int *sizep)
{
sa_handle_t *sa_hdl = NULL;
sa_handle_t *sa_hdl = NULL;
- uint64_t xa_data_obj, size;
- int rc;
+ uint64_t xa_data_obj, size;
+ int rc;
/* are there any extended attributes? */
if (xattr == ZFS_NO_OBJECT)
/* are there any extended attributes? */
if (xattr == ZFS_NO_OBJECT)
.lb_len = sizeof(info->oti_buf),
};
int rc;
.lb_len = sizeof(info->oti_buf),
};
int rc;
BUILD_BUG_ON(sizeof(info->oti_buf) < sizeof(*loa));
rc = osd_xattr_get_internal(env, obj, &tbuf,
XATTR_NAME_LMA, sizep);
BUILD_BUG_ON(sizeof(info->oti_buf) < sizeof(*loa));
rc = osd_xattr_get_internal(env, obj, &tbuf,
XATTR_NAME_LMA, sizep);
int osd_xattr_get(const struct lu_env *env, struct dt_object *dt,
struct lu_buf *buf, const char *name)
{
int osd_xattr_get(const struct lu_env *env, struct dt_object *dt,
struct lu_buf *buf, const char *name)
{
- struct osd_object *obj = osd_dt_obj(dt);
- int rc, size = 0;
- ENTRY;
+ struct osd_object *obj = osd_dt_obj(dt);
+ int rc, size = 0;
if (!osd_obj2dev(obj)->od_posix_acl &&
(strcmp(name, XATTR_NAME_POSIX_ACL_ACCESS) == 0 ||
strcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT) == 0))
if (!osd_obj2dev(obj)->od_posix_acl &&
(strcmp(name, XATTR_NAME_POSIX_ACL_ACCESS) == 0 ||
strcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT) == 0))
LASSERT(obj->oo_dn != NULL);
/* For the OST migrated from ldiskfs, the PFID EA may
LASSERT(obj->oo_dn != NULL);
/* For the OST migrated from ldiskfs, the PFID EA may
- * be stored in LMA because of ldiskfs inode size. */
+ * be stored in LMA because of ldiskfs inode size.
+ */
if (strcmp(name, XATTR_NAME_FID) == 0 && obj->oo_pfid_in_lma)
rc = osd_get_pfid_from_lma(env, obj, buf, &size);
else
if (strcmp(name, XATTR_NAME_FID) == 0 && obj->oo_pfid_in_lma)
rc = osd_get_pfid_from_lma(env, obj, buf, &size);
else
* remote entry will be removed, then related agent entry may
* need to be removed from the remote parent. So there may be
* kinds of cases, let's declare enough credits. The credits
* remote entry will be removed, then related agent entry may
* need to be removed from the remote parent. So there may be
* kinds of cases, let's declare enough credits. The credits
- * for create agent entry is enough for remove case. */
+ * for create agent entry is enough for remove case.
+ */
osd_tx_hold_zap(tx, osd->od_remote_parent_dir,
NULL, TRUE, NULL);
}
osd_tx_hold_zap(tx, osd->od_remote_parent_dir,
NULL, TRUE, NULL);
}
/* declare EA in SA */
if (dt_object_exists(&obj->oo_dt)) {
LASSERT(obj->oo_sa_hdl);
/* declare EA in SA */
if (dt_object_exists(&obj->oo_dt)) {
LASSERT(obj->oo_sa_hdl);
- /* XXX: it should be possible to skip spill
- * declaration if specific EA is part of
- * bonus and doesn't grow */
+ /* XXX: it should be possible to skip spill declaration if
+ * specific EA is part of bonus and doesn't grow
+ */
dmu_tx_hold_spill(tx, obj->oo_dn->dn_object);
return;
}
dmu_tx_hold_spill(tx, obj->oo_dn->dn_object);
return;
}
bonuslen = osd_obj_bonuslen(obj);
/* the object doesn't exist, but we've declared bonus
bonuslen = osd_obj_bonuslen(obj);
/* the object doesn't exist, but we've declared bonus
- * in osd_declare_object_create() yet */
+ * in osd_declare_object_create() yet
+ */
if (obj->oo_ea_in_bonus > bonuslen) {
/* spill has been declared already */
} else if (obj->oo_ea_in_bonus + vallen > bonuslen) {
if (obj->oo_ea_in_bonus > bonuslen) {
/* spill has been declared already */
} else if (obj->oo_ea_in_bonus + vallen > bonuslen) {
const struct lu_buf *buf, const char *name,
int fl, struct thandle *handle)
{
const struct lu_buf *buf, const char *name,
int fl, struct thandle *handle)
{
- struct osd_object *obj = osd_dt_obj(dt);
+ struct osd_object *obj = osd_dt_obj(dt);
LASSERT(handle != NULL);
oh = container_of(handle, struct osd_thandle, ot_super);
LASSERT(handle != NULL);
oh = container_of(handle, struct osd_thandle, ot_super);
lu_buf_check_and_alloc(lb, size);
if (lb->lb_buf == NULL) {
lu_buf_check_and_alloc(lb, size);
if (lb->lb_buf == NULL) {
- CERROR("%s: can't allocate buffer for xattr update\n",
- osd->od_svname);
- return -ENOMEM;
+ rc = -ENOMEM;
+ CERROR("%s: can't allocate buffer for xattr update: rc = %d\n",
+ osd->od_svname, rc);
+ return rc;
}
rc = -nvlist_pack(obj->oo_sa_xattr, (char **)&lb->lb_buf, &size,
}
rc = -nvlist_pack(obj->oo_sa_xattr, (char **)&lb->lb_buf, &size,
int __osd_sa_xattr_update(const struct lu_env *env, struct osd_object *obj,
struct osd_thandle *oh)
{
int __osd_sa_xattr_update(const struct lu_env *env, struct osd_object *obj,
struct osd_thandle *oh)
{
- struct lu_buf *lb = &osd_oti_get(env)->oti_xattr_lbuf;
+ struct lu_buf *lb = &osd_oti_get(env)->oti_xattr_lbuf;
struct osd_device *osd = osd_obj2dev(obj);
struct osd_device *osd = osd_obj2dev(obj);
- char *dxattr;
- size_t size;
- int rc;
+ char *dxattr;
+ size_t size;
+ int rc;
lu_buf_check_and_alloc(lb, size);
if (lb->lb_buf == NULL) {
lu_buf_check_and_alloc(lb, size);
if (lb->lb_buf == NULL) {
- CERROR("%s: can't allocate buffer for xattr update\n",
- osd->od_svname);
- return -ENOMEM;
+ rc = -ENOMEM;
+ CERROR("%s: can't allocate buffer for xattr update: rc = %d\n",
+ osd->od_svname, rc);
+ return rc;
struct osd_thandle *oh)
{
uchar_t *nv_value;
struct osd_thandle *oh)
{
uchar_t *nv_value;
- size_t size;
- int nv_size;
- int rc;
- int too_big = 0;
+ size_t size;
+ int nv_size;
+ int rc;
+ int too_big = 0;
rc = __osd_xattr_cache(obj);
if (rc)
rc = __osd_xattr_cache(obj);
if (rc)
if (buf->lb_len > OBD_MAX_EA_SIZE) {
too_big = 1;
} else {
if (buf->lb_len > OBD_MAX_EA_SIZE) {
too_big = 1;
} else {
- /* Prevent the DXATTR SA from consuming the entire SA
- * region */
+ /* Prevent the DXATTR SA from consuming the entire SA region */
rc = -nvlist_size(obj->oo_sa_xattr, &size, NV_ENCODE_XDR);
if (rc)
return rc;
rc = -nvlist_size(obj->oo_sa_xattr, &size, NV_ENCODE_XDR);
if (rc)
return rc;
}
/* even in case of -EFBIG we must lookup xattr and check can we
}
/* even in case of -EFBIG we must lookup xattr and check can we
- * rewrite it then delete from SA */
+ * rewrite it then delete from SA
+ */
rc = -nvlist_lookup_byte_array(obj->oo_sa_xattr, name, &nv_value,
&nv_size);
if (rc == 0) {
rc = -nvlist_lookup_byte_array(obj->oo_sa_xattr, name, &nv_value,
&nv_size);
if (rc == 0) {
if (obj->oo_xattr != ZFS_NO_OBJECT) {
struct osd_device *osd = osd_obj2dev(obj);
uint64_t objid;
if (obj->oo_xattr != ZFS_NO_OBJECT) {
struct osd_device *osd = osd_obj2dev(obj);
uint64_t objid;
rc = -zap_lookup(osd->od_os, obj->oo_xattr,
name, 8, 1, &objid);
if (rc == 0) {
rc = -zap_lookup(osd->od_os, obj->oo_xattr,
name, 8, 1, &objid);
if (rc == 0) {
return rc;
/* batch updates only for just created dnodes where we
return rc;
/* batch updates only for just created dnodes where we
- * used to set number of EAs in a single transaction */
+ * used to set number of EAs in a single transaction
+ */
if (obj->oo_dn->dn_allocated_txg == oh->ot_tx->tx_txg)
rc = __osd_sa_xattr_schedule_update(env, obj, oh);
else
if (obj->oo_dn->dn_allocated_txg == oh->ot_tx->tx_txg)
rc = __osd_sa_xattr_schedule_update(env, obj, oh);
else
struct osd_device *osd = osd_obj2dev(obj);
dnode_t *xa_zap_dn = NULL;
dnode_t *xa_data_dn = NULL;
struct osd_device *osd = osd_obj2dev(obj);
dnode_t *xa_zap_dn = NULL;
dnode_t *xa_data_dn = NULL;
- uint64_t xa_data_obj;
- sa_handle_t *sa_hdl = NULL;
- dmu_tx_t *tx = oh->ot_tx;
- uint64_t size;
- int rc;
+ uint64_t xa_data_obj;
+ sa_handle_t *sa_hdl = NULL;
+ dmu_tx_t *tx = oh->ot_tx;
+ uint64_t size;
+ int rc;
struct lu_attr *la = &osd_oti_get(env)->oti_la;
la->la_valid = LA_MODE;
struct lu_attr *la = &osd_oti_get(env)->oti_la;
la->la_valid = LA_MODE;
- la->la_mode = S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO;
+ la->la_mode = S_IFDIR | 0755;
rc = __osd_zap_create(env, osd, &xa_zap_dn, tx, la, 0, 0);
if (rc)
return rc;
rc = __osd_zap_create(env, osd, &xa_zap_dn, tx, la, 0, 0);
if (rc)
return rc;
rc = -EEXIST;
goto out;
}
rc = -EEXIST;
goto out;
}
- /*
- * Entry already exists.
- * We'll truncate the existing object.
- */
+ /* Entry already exists. We'll truncate the existing object. */
rc = __osd_obj2dnode(osd->od_os, xa_data_obj, &xa_data_dn);
if (rc)
goto out;
rc = __osd_obj2dnode(osd->od_os, xa_data_obj, &xa_data_dn);
if (rc)
goto out;
*/
if (fl & LU_XATTR_REPLACE) {
/* should be ENOATTR according to the
*/
if (fl & LU_XATTR_REPLACE) {
/* should be ENOATTR according to the
- * man, but that is undefined here */
+ * man, but that is undefined here
+ */
rc = -ENODATA;
goto out;
}
la->la_valid = LA_MODE;
rc = -ENODATA;
goto out;
}
la->la_valid = LA_MODE;
- la->la_mode = S_IFREG | S_IRUGO | S_IWUSR;
+ la->la_mode = S_IFREG | 0644;
rc = __osd_object_create(env, osd, obj,
lu_object_fid(&obj->oo_dt.do_lu),
&xa_data_dn, tx, la);
rc = __osd_object_create(env, osd, obj,
lu_object_fid(&obj->oo_dt.do_lu),
&xa_data_dn, tx, la);
BUILD_BUG_ON(sizeof(info->oti_buf) < sizeof(*loa));
rc = osd_xattr_get_internal(env, obj, &buf, XATTR_NAME_LMA, &size);
if (rc)
BUILD_BUG_ON(sizeof(info->oti_buf) < sizeof(*loa));
rc = osd_xattr_get_internal(env, obj, &buf, XATTR_NAME_LMA, &size);
if (rc)
struct lu_name tmpname;
int rc;
bool remote = false;
struct lu_name tmpname;
int rc;
bool remote = false;
rc = linkea_init_with_rec(&ldata);
if (!rc) {
linkea_first_entry(&ldata);
rc = linkea_init_with_rec(&ldata);
if (!rc) {
linkea_first_entry(&ldata);
if (lu_object_has_agent_entry(&obj->oo_dt.do_lu) && !remote) {
rc = osd_delete_from_remote_parent(env, osd, obj, oh, false);
if (rc)
if (lu_object_has_agent_entry(&obj->oo_dt.do_lu) && !remote) {
rc = osd_delete_from_remote_parent(env, osd, obj, oh, false);
if (rc)
- CERROR("%s: failed to remove agent entry for "DFID
- ": rc = %d\n", osd_name(osd), PFID(fid), rc);
+ CERROR("%s: failed to remove agent entry for "DFID": rc = %d\n",
+ osd_name(osd), PFID(fid), rc);
} else if (!lu_object_has_agent_entry(&obj->oo_dt.do_lu) && remote) {
rc = osd_add_to_remote_parent(env, osd, obj, oh);
if (rc)
} else if (!lu_object_has_agent_entry(&obj->oo_dt.do_lu) && remote) {
rc = osd_add_to_remote_parent(env, osd, obj, oh);
if (rc)
- CWARN("%s: failed to create agent entry for "DFID
- ": rc = %d\n", osd_name(osd), PFID(fid), rc);
+ CWARN("%s: failed to create agent entry for "DFID": rc = %d\n",
+ osd_name(osd), PFID(fid), rc);
struct osd_device *osd = osd_obj2dev(obj);
struct osd_thandle *oh;
int rc = 0;
struct osd_device *osd = osd_obj2dev(obj);
struct osd_thandle *oh;
int rc = 0;
LASSERT(handle != NULL);
LASSERT(osd_invariant(obj));
LASSERT(handle != NULL);
LASSERT(osd_invariant(obj));
CDEBUG(D_INODE, "Setting xattr %s with size %d\n",
name, (int)buf->lb_len);
/* For the OST migrated from ldiskfs, the PFID EA may
CDEBUG(D_INODE, "Setting xattr %s with size %d\n",
name, (int)buf->lb_len);
/* For the OST migrated from ldiskfs, the PFID EA may
- * be stored in LMA because of ldiskfs inode size. */
+ * be stored in LMA because of ldiskfs inode size.
+ */
if (unlikely(strcmp(name, XATTR_NAME_FID) == 0 &&
obj->oo_pfid_in_lma)) {
rc = osd_xattr_split_pfid(env, obj, oh);
if (unlikely(strcmp(name, XATTR_NAME_FID) == 0 &&
obj->oo_pfid_in_lma)) {
rc = osd_xattr_split_pfid(env, obj, oh);
const char *name, struct osd_thandle *oh)
{
struct osd_device *osd = osd_obj2dev(obj);
const char *name, struct osd_thandle *oh)
{
struct osd_device *osd = osd_obj2dev(obj);
- dmu_tx_t *tx = oh->ot_tx;
- uint64_t xa_data_obj;
- int rc;
+ dmu_tx_t *tx = oh->ot_tx;
+ uint64_t xa_data_obj;
+ int rc;
/* update SA_ZPL_DXATTR if xattr was in SA */
dmu_tx_hold_sa(tx, obj->oo_sa_hdl, 0);
/* update SA_ZPL_DXATTR if xattr was in SA */
dmu_tx_hold_sa(tx, obj->oo_sa_hdl, 0);
rc = -zap_lookup(osd->od_os, obj->oo_xattr, name, 8, 1, &xa_data_obj);
if (rc == 0) {
rc = -zap_lookup(osd->od_os, obj->oo_xattr, name, 8, 1, &xa_data_obj);
if (rc == 0) {
- /*
- * Entry exists.
- * We'll delete the existing object and ZAP entry.
- */
+ /* Entry exists. Will delete the existing obj and ZAP entry */
dmu_tx_hold_bonus(tx, xa_data_obj);
dmu_tx_hold_free(tx, xa_data_obj, 0, DMU_OBJECT_END);
dmu_tx_hold_zap(tx, obj->oo_xattr, FALSE, (char *) name);
dmu_tx_hold_bonus(tx, xa_data_obj);
dmu_tx_hold_free(tx, xa_data_obj, 0, DMU_OBJECT_END);
dmu_tx_hold_zap(tx, obj->oo_xattr, FALSE, (char *) name);
int osd_declare_xattr_del(const struct lu_env *env, struct dt_object *dt,
const char *name, struct thandle *handle)
{
int osd_declare_xattr_del(const struct lu_env *env, struct dt_object *dt,
const char *name, struct thandle *handle)
{
- struct osd_object *obj = osd_dt_obj(dt);
+ struct osd_object *obj = osd_dt_obj(dt);
LASSERT(handle != NULL);
LASSERT(osd_invariant(obj));
LASSERT(handle != NULL);
LASSERT(osd_invariant(obj));
const char *name, struct osd_thandle *oh)
{
struct osd_device *osd = osd_obj2dev(obj);
const char *name, struct osd_thandle *oh)
{
struct osd_device *osd = osd_obj2dev(obj);
- uint64_t xa_data_obj;
- int rc;
+ uint64_t xa_data_obj;
+ int rc;
if (unlikely(!dt_object_exists(&obj->oo_dt) || obj->oo_destroyed))
return -ENOENT;
if (unlikely(!dt_object_exists(&obj->oo_dt) || obj->oo_destroyed))
return -ENOENT;
if (rc == -ENOENT) {
rc = 0;
} else if (rc == 0) {
if (rc == -ENOENT) {
rc = 0;
} else if (rc == 0) {
- /*
- * Entry exists.
- * We'll delete the existing object and ZAP entry.
- */
+ /* Entry exists. We'll delete the existing obj and ZAP entry */
rc = -dmu_object_free(osd->od_os, xa_data_obj, oh->ot_tx);
if (rc)
return rc;
rc = -dmu_object_free(osd->od_os, xa_data_obj, oh->ot_tx);
if (rc)
return rc;
{
struct osd_object *obj = osd_dt_obj(dt);
struct osd_thandle *oh;
{
struct osd_object *obj = osd_dt_obj(dt);
struct osd_thandle *oh;
LASSERT(handle != NULL);
oh = container_of(handle, struct osd_thandle, ot_super);
LASSERT(oh->ot_tx != NULL);
LASSERT(handle != NULL);
oh = container_of(handle, struct osd_thandle, ot_super);
LASSERT(oh->ot_tx != NULL);
GOTO(out, rc = -ENOENT);
LASSERT(obj->oo_dn != NULL);
/* For the OST migrated from ldiskfs, the PFID EA may
GOTO(out, rc = -ENOENT);
LASSERT(obj->oo_dn != NULL);
/* For the OST migrated from ldiskfs, the PFID EA may
- * be stored in LMA because of ldiskfs inode size. */
+ * be stored in LMA because of ldiskfs inode size.
+ */
if (unlikely(strcmp(name, XATTR_NAME_FID) == 0 && obj->oo_pfid_in_lma))
rc = osd_xattr_split_pfid(env, obj, oh);
else
if (unlikely(strcmp(name, XATTR_NAME_FID) == 0 && obj->oo_pfid_in_lma))
rc = osd_xattr_split_pfid(env, obj, oh);
else
struct osd_object *obj, struct osd_thandle *oh)
{
struct osd_device *osd = osd_obj2dev(obj);
struct osd_object *obj, struct osd_thandle *oh)
{
struct osd_device *osd = osd_obj2dev(obj);
- zap_attribute_t *za = &osd_oti_get(env)->oti_za;
- uint64_t oid = obj->oo_xattr, xid;
- dmu_tx_t *tx = oh->ot_tx;
- zap_cursor_t *zc;
- int rc;
+ zap_attribute_t *za = &osd_oti_get(env)->oti_za;
+ uint64_t oid = obj->oo_xattr, xid;
+ dmu_tx_t *tx = oh->ot_tx;
+ zap_cursor_t *zc;
+ int rc;
if (oid == ZFS_NO_OBJECT)
return; /* Nothing to do for SA xattrs */
if (oid == ZFS_NO_OBJECT)
return; /* Nothing to do for SA xattrs */
struct osd_object *obj, struct osd_thandle *oh)
{
struct osd_device *osd = osd_obj2dev(obj);
struct osd_object *obj, struct osd_thandle *oh)
{
struct osd_device *osd = osd_obj2dev(obj);
- dmu_tx_t *tx = oh->ot_tx;
- zap_attribute_t *za = &osd_oti_get(env)->oti_za;
- zap_cursor_t *zc;
- uint64_t xid;
- int rc;
+ dmu_tx_t *tx = oh->ot_tx;
+ zap_attribute_t *za = &osd_oti_get(env)->oti_za;
+ zap_cursor_t *zc;
+ uint64_t xid;
+ int rc;
/* The transaction must have been assigned to a transaction group. */
LASSERT(tx->tx_txg != 0);
/* The transaction must have been assigned to a transaction group. */
LASSERT(tx->tx_txg != 0);
const struct lu_buf *lb)
{
nvpair_t *nvp = NULL;
const struct lu_buf *lb)
{
nvpair_t *nvp = NULL;
- int len, counted = 0;
- int rc = 0;
+ int len, counted = 0;
+ int rc = 0;
rc = __osd_xattr_cache(obj);
if (rc)
rc = __osd_xattr_cache(obj);
if (rc)
int osd_xattr_list(const struct lu_env *env, struct dt_object *dt,
const struct lu_buf *lb)
{
int osd_xattr_list(const struct lu_env *env, struct dt_object *dt,
const struct lu_buf *lb)
{
- struct osd_object *obj = osd_dt_obj(dt);
- struct osd_device *osd = osd_obj2dev(obj);
- zap_attribute_t *za = &osd_oti_get(env)->oti_za;
- zap_cursor_t *zc;
- int rc, counted;
- ENTRY;
+ struct osd_object *obj = osd_dt_obj(dt);
+ struct osd_device *osd = osd_obj2dev(obj);
+ zap_attribute_t *za = &osd_oti_get(env)->oti_za;
+ zap_cursor_t *zc;
+ int rc, counted;
down_read(&obj->oo_guard);
if (unlikely(!dt_object_exists(dt) || obj->oo_destroyed))
GOTO(out, rc = -ENOENT);
down_read(&obj->oo_guard);
if (unlikely(!dt_object_exists(dt) || obj->oo_destroyed))
GOTO(out, rc = -ENOENT);