verify = 1;
}
- fid_zero(&oic->oic_fid);
-
/*
* Objects are created as locking anchors or place holders for objects
* yet to be created. No need to osd_oi_lookup() at here because FID
if (IS_ERR(inode)) {
result = PTR_ERR(inode);
if (result == -ENOENT || result == -ESTALE) {
+ fid_zero(&oic->oic_fid);
result = 0;
} else if (result == -EREMCHG) {
/* call per-transaction callbacks if any */
cfs_list_for_each_entry_safe(dcb, tmp, &oh->ot_dcb_list, dcb_linkage) {
+ LASSERTF(dcb->dcb_magic == TRANS_COMMIT_CB_MAGIC,
+ "commit callback entry: magic=%x name='%s'\n",
+ dcb->dcb_magic, dcb->dcb_name);
cfs_list_del_init(&dcb->dcb_linkage);
dcb->dcb_func(NULL, th, dcb, error);
}
static int osd_trans_cb_add(struct thandle *th, struct dt_txn_commit_cb *dcb)
{
- struct osd_thandle *oh = container_of0(th, struct osd_thandle,
- ot_super);
+ struct osd_thandle *oh = container_of0(th, struct osd_thandle,
+ ot_super);
- cfs_list_add(&dcb->dcb_linkage, &oh->ot_dcb_list);
+ LASSERT(dcb->dcb_magic == TRANS_COMMIT_CB_MAGIC);
+ LASSERT(&dcb->dcb_func != NULL);
+ cfs_list_add(&dcb->dcb_linkage, &oh->ot_dcb_list);
- return 0;
+ return 0;
}
/*
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, 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);
- }
- }
+ 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 = sb->s_op->statfs(sb->s_root, 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_statfs;
attr->la_flags = LDISKFS_I(inode)->i_flags;
attr->la_nlink = inode->i_nlink;
attr->la_rdev = inode->i_rdev;
- attr->la_blksize = ll_inode_blksize(inode);
- attr->la_blkbits = inode->i_blkbits;
+ attr->la_blksize = 1 << inode->i_blkbits;
+ attr->la_blkbits = inode->i_blkbits;
}
static int osd_attr_get(const struct lu_env *env,
const struct lu_buf *buf, const char *name,
int fl, struct thandle *handle)
{
- struct osd_thandle *oh;
-
- LASSERT(handle != NULL);
+ struct osd_thandle *oh;
- if (strcmp(name, XATTR_NAME_VERSION) == 0) {
- /* no credits for version */
- return 0;
- }
+ LASSERT(handle != NULL);
- oh = container_of0(handle, struct osd_thandle, ot_super);
- LASSERT(oh->ot_handle == NULL);
+ oh = container_of0(handle, struct osd_thandle, ot_super);
+ LASSERT(oh->ot_handle == NULL);
- OSD_DECLARE_OP(oh, xattr_set);
- oh->ot_credits += osd_dto_credits_noquota[DTO_XATTR_SET];
+ OSD_DECLARE_OP(oh, xattr_set);
+ if (strcmp(name, XATTR_NAME_VERSION) == 0)
+ oh->ot_credits += osd_dto_credits_noquota[DTO_ATTR_SET_BASE];
+ else
+ oh->ot_credits += osd_dto_credits_noquota[DTO_XATTR_SET];
- return 0;
+ return 0;
}
/*
static int osd_object_sync(const struct lu_env *env, struct dt_object *dt)
{
- struct osd_object *obj = osd_dt_obj(dt);
- struct inode *inode = obj->oo_inode;
- struct osd_thread_info *info = osd_oti_get(env);
- struct dentry *dentry = &info->oti_obj_dentry;
- struct file *file = &info->oti_file;
- int rc;
+ struct osd_object *obj = osd_dt_obj(dt);
+ struct inode *inode = obj->oo_inode;
+ struct osd_thread_info *info = osd_oti_get(env);
+ struct dentry *dentry = &info->oti_obj_dentry;
+ struct file *file = &info->oti_file;
+ int rc;
- ENTRY;
+ ENTRY;
- dentry->d_inode = inode;
- file->f_dentry = dentry;
- file->f_mapping = inode->i_mapping;
- file->f_op = inode->i_fop;
- LOCK_INODE_MUTEX(inode);
- rc = file->f_op->fsync(file, dentry, 0);
- UNLOCK_INODE_MUTEX(inode);
- RETURN(rc);
+ dentry->d_inode = inode;
+ file->f_dentry = dentry;
+ file->f_mapping = inode->i_mapping;
+ file->f_op = inode->i_fop;
+ mutex_lock(&inode->i_mutex);
+ rc = file->f_op->fsync(file, dentry, 0);
+ mutex_unlock(&inode->i_mutex);
+ RETURN(rc);
}
static int osd_data_get(const struct lu_env *env, struct dt_object *dt,
return result;
result = iam_container_setup(bag);
- if (result != 0)
- goto out;
-
- if (osd_obj2dev(obj)->od_iop_mode) {
- u32 ptr = bag->ic_descr->id_ops->id_root_ptr(bag);
-
- bag->ic_root_bh = ldiskfs_bread(NULL, obj->oo_inode,
- ptr, 0, &result);
- }
-
- out:
if (result == 0)
obj->oo_dt.do_index_ops = &osd_index_iam_ops;
else
rc = osd_ea_fid_get(env, obj, ino, fid, &oic->oic_lid);
else
osd_id_gen(&oic->oic_lid, ino, OSD_OII_NOGEN);
-
- if (rc != 0 || !fid_is_norm(fid))
+ if (rc != 0 || !fid_is_norm(fid)) {
+ fid_zero(&oic->oic_fid);
GOTO(out, rc);
+ }
oic->oic_fid = *fid;
if ((scrub->os_pos_current <= ino) &&
it->oie_file.f_pos = 0;
it->oie_file.f_dentry = obj_dentry;
if (attr & LUDA_64BITHASH)
- it->oie_file.f_flags = O_64BITHASH;
+ it->oie_file.f_mode |= FMODE_64BITHASH;
else
- it->oie_file.f_flags = O_32BITHASH;
+ it->oie_file.f_mode |= FMODE_32BITHASH;
it->oie_file.f_mapping = obj->oo_inode->i_mapping;
it->oie_file.f_op = obj->oo_inode->i_fop;
it->oie_file.private_data = NULL;
it->oie_it_dirent++;
RETURN(0);
} else {
- if (it->oie_file.f_pos == LDISKFS_HTREE_EOF)
+ if (it->oie_file.f_pos == ldiskfs_get_htree_eof(&it->oie_file))
rc = +1;
else
rc = osd_ldiskfs_it_fill(env, di);
it->oie_dirent->oied_name,
it->oie_dirent->oied_namelen,
it->oie_dirent->oied_type, attr);
-
- if (!fid_is_norm(fid))
+ if (!fid_is_norm(fid)) {
+ fid_zero(&oic->oic_fid);
RETURN(0);
+ }
oic->oic_fid = *fid;
if ((scrub->os_pos_current <= ino) &&
RETURN(result);
}
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2,3,50,0)
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 3, 55, 0)
/* Unfortunately, the current MDD implementation relies on some specific
* code to be executed in the OSD layer. Since OFD now also uses the OSD
* module, we need a way to skip the metadata-specific code when running