* Concurrency: shouldn't matter.
*/
int osd_statfs(const struct lu_env *env, struct dt_device *d,
- cfs_kstatfs_t *sfs)
+ struct obd_statfs *sfs)
{
- struct osd_device *osd = osd_dt_dev(d);
+ struct osd_device *osd = osd_dt_dev(d);
struct super_block *sb = osd_sb(osd);
+ struct kstatfs *ksfs;
int result = 0;
+ /* osd_lproc.c call this without env, allocate ksfs for that case */
+ if (unlikely(env == NULL)) {
+ OBD_ALLOC_PTR(ksfs);
+ if (ksfs == NULL)
+ return -ENOMEM;
+ } else {
+ ksfs = &osd_oti_get(env)->oti_ksfs;
+ }
+
cfs_spin_lock(&osd->od_osfs_lock);
/* cache 1 second */
if (cfs_time_before_64(osd->od_osfs_age, cfs_time_shift_64(-1))) {
- result = ll_do_statfs(sb, &osd->od_kstatfs);
- if (likely(result == 0)) /* N.B. statfs can't really fail */
+ result = ll_do_statfs(sb, ksfs);
+ if (likely(result == 0)) { /* N.B. statfs can't really fail */
osd->od_osfs_age = cfs_time_current_64();
+ statfs_pack(&osd->od_statfs, ksfs);
+ }
}
if (likely(result == 0))
- *sfs = osd->od_kstatfs;
+ *sfs = osd->od_statfs;
cfs_spin_unlock(&osd->od_osfs_lock);
+ if (unlikely(env == NULL))
+ OBD_FREE_PTR(ksfs);
+
return result;
}
LASSERT(!(bits & LA_TYPE)); /* Huh? You want too much. */
-#ifdef HAVE_QUOTA_SUPPORT
- if ((bits & LA_UID && attr->la_uid != inode->i_uid) ||
- (bits & LA_GID && attr->la_gid != inode->i_gid)) {
- struct osd_ctxt *save = &osd_oti_get(env)->oti_ctxt;
- struct iattr iattr;
- int rc;
-
- iattr.ia_valid = 0;
- if (bits & LA_UID)
- iattr.ia_valid |= ATTR_UID;
- if (bits & LA_GID)
- iattr.ia_valid |= ATTR_GID;
- iattr.ia_uid = attr->la_uid;
- iattr.ia_gid = attr->la_gid;
- osd_push_ctxt(env, save);
- rc = ll_vfs_dq_transfer(inode, &iattr) ? -EDQUOT : 0;
- osd_pop_ctxt(save);
- if (rc != 0)
- return rc;
- }
-#endif
-
if (bits & LA_ATIME)
inode->i_atime = *osd_inode_time(env, inode, attr->la_atime);
if (bits & LA_CTIME)
struct lustre_capa *capa)
{
struct osd_object *obj = osd_dt_obj(dt);
+ struct inode *inode;
int rc;
LASSERT(handle != NULL);
OSD_EXEC_OP(handle, attr_set);
+ inode = obj->oo_inode;
+#ifdef HAVE_QUOTA_SUPPORT
+ if ((attr->la_valid & LA_UID && attr->la_uid != inode->i_uid) ||
+ (attr->la_valid & LA_GID && attr->la_gid != inode->i_gid)) {
+ struct osd_ctxt *save = &osd_oti_get(env)->oti_ctxt;
+ struct iattr iattr;
+ int rc;
+
+ iattr.ia_valid = 0;
+ if (attr->la_valid & LA_UID)
+ iattr.ia_valid |= ATTR_UID;
+ if (attr->la_valid & LA_GID)
+ iattr.ia_valid |= ATTR_GID;
+ iattr.ia_uid = attr->la_uid;
+ iattr.ia_gid = attr->la_gid;
+ osd_push_ctxt(env, save);
+ rc = ll_vfs_dq_transfer(inode, &iattr) ? -EDQUOT : 0;
+ osd_pop_ctxt(save);
+ if (rc != 0)
+ return rc;
+ }
+#endif
+
cfs_spin_lock(&obj->oo_guard);
- rc = osd_inode_setattr(env, obj->oo_inode, attr);
+ rc = osd_inode_setattr(env, inode, attr);
cfs_spin_unlock(&obj->oo_guard);
if (!rc)
- obj->oo_inode->i_sb->s_op->dirty_inode(obj->oo_inode);
+ inode->i_sb->s_op->dirty_inode(inode);
return rc;
}
LU_TYPE_INIT_FINI(osd, &osd_key);
struct lu_context_key osd_key = {
- .lct_tags = LCT_DT_THREAD | LCT_MD_THREAD,
+ .lct_tags = LCT_DT_THREAD | LCT_MD_THREAD | LCT_MG_THREAD | LCT_LOCAL,
.lct_init = osd_key_init,
.lct_fini = osd_key_fini,
.lct_exit = osd_key_exit
.ldt_tags = LU_DEVICE_DT,
.ldt_name = LUSTRE_OSD_NAME,
.ldt_ops = &osd_device_type_ops,
- .ldt_ctx_tags = LCT_MD_THREAD|LCT_DT_THREAD
+ .ldt_ctx_tags = LCT_LOCAL,
};
/*