dname.name = target;
dname.len = strlen(dname.name);
- dname.hash = ll_full_name_hash(parent, dname.name, dname.len);
+ dname.hash = ll_full_name_hash(debugfs_lustre_root,
+ dname.name, dname.len);
parent = d_lookup(debugfs_lustre_root, &dname);
if (!parent)
return NULL;
sprintf(name, DFID_NOBRACE, PFID(lu_object_fid(&obj->oo_dt.do_lu)));
dentry = osd_child_dentry_by_inode(env, parent->d_inode,
name, strlen(name));
- mutex_lock(&parent->d_inode->i_mutex);
+ inode_lock(parent->d_inode);
rc = osd_ldiskfs_add_entry(info, osd, oh->ot_handle, dentry,
obj->oo_inode, NULL);
if (!rc && S_ISDIR(obj->oo_inode->i_mode))
CDEBUG(D_INODE, "%s: create agent entry for %s: rc = %d\n",
osd_name(osd), name, rc);
mark_inode_dirty(parent->d_inode);
- mutex_unlock(&parent->d_inode->i_mutex);
+ inode_unlock(parent->d_inode);
RETURN(rc);
}
sprintf(name, DFID_NOBRACE, PFID(lu_object_fid(&obj->oo_dt.do_lu)));
dentry = osd_child_dentry_by_inode(env, parent->d_inode,
name, strlen(name));
- mutex_lock(&parent->d_inode->i_mutex);
+ inode_lock(parent->d_inode);
bh = osd_ldiskfs_find_entry(parent->d_inode, &dentry->d_name, &de,
NULL, NULL);
if (IS_ERR(bh)) {
- mutex_unlock(&parent->d_inode->i_mutex);
+ inode_unlock(parent->d_inode);
rc = PTR_ERR(bh);
if (unlikely(rc == -ENOENT))
rc = 0;
if (!rc && S_ISDIR(obj->oo_inode->i_mode))
ldiskfs_dec_count(oh->ot_handle, parent->d_inode);
mark_inode_dirty(parent->d_inode);
- mutex_unlock(&parent->d_inode->i_mutex);
+ inode_unlock(parent->d_inode);
brelse(bh);
CDEBUG(D_INODE, "%s: remove agent entry for %s: rc = %d\n",
osd_name(osd), name, rc);
sprintf(name, DFID_NOBRACE, PFID(fid));
dentry = osd_child_dentry_by_inode(oti->oti_env, parent->d_inode,
name, strlen(name));
- mutex_lock(&parent->d_inode->i_mutex);
+ inode_lock(parent->d_inode);
bh = osd_ldiskfs_find_entry(parent->d_inode, &dentry->d_name, &de,
NULL, NULL);
if (IS_ERR(bh)) {
rc = 0;
}
}
- mutex_unlock(&parent->d_inode->i_mutex);
+ inode_unlock(parent->d_inode);
if (rc == 0)
osd_add_oi_cache(oti, osd, id, fid);
RETURN(rc);
child->d_name.len = strlen(name);
ll_vfs_dq_init(parent);
- mutex_lock(&parent->i_mutex);
+ inode_lock(parent);
bh = osd_ldiskfs_find_entry(parent, &child->d_name, &de, NULL, NULL);
if (IS_ERR(bh))
GOTO(out, rc = PTR_ERR(bh));
out:
if (!IS_ERR(bh))
brelse(bh);
- mutex_unlock(&parent->i_mutex);
+ inode_unlock(parent);
return rc;
}
child->d_inode = NULL;
ll_vfs_dq_init(dir);
- mutex_lock(&dir->i_mutex);
+ inode_lock(dir);
bh = osd_ldiskfs_find_entry(dir, &child->d_name, &de, NULL, NULL);
if (IS_ERR(bh)) {
rc = PTR_ERR(bh);
rc = ldiskfs_delete_entry(th, dir, de, bh);
brelse(bh);
}
- mutex_unlock(&dir->i_mutex);
+ inode_unlock(dir);
RETURN(rc);
}
inode->i_ino++;
ll_vfs_dq_init(dir->d_inode);
- mutex_lock(&dir->d_inode->i_mutex);
+ inode_lock(dir->d_inode);
rc = osd_ldiskfs_add_entry(info, osd, th, child, inode, NULL);
- mutex_unlock(&dir->d_inode->i_mutex);
+ inode_unlock(dir->d_inode);
RETURN(rc);
}
child->d_name.len = strlen(name);
dir = d_seq->d_inode;
- mutex_lock(&dir->i_mutex);
+ inode_lock(dir);
bh = osd_ldiskfs_find_entry(dir, &child->d_name, &de, NULL, NULL);
- mutex_unlock(&dir->i_mutex);
+ inode_unlock(dir);
if (IS_ERR(bh))
RETURN(PTR_ERR(bh));
ll_vfs_dq_init(src_parent);
ll_vfs_dq_init(dir);
- mutex_lock(&src_parent->i_mutex);
- mutex_lock(&dir->i_mutex);
+ inode_lock(src_parent);
+ inode_lock(dir);
bh = osd_ldiskfs_find_entry(dir, &tgt_child->d_name, &de, NULL, NULL);
if (!IS_ERR(bh)) {
/* XXX: If some other object occupied the same slot. And If such
*
* So keep it there before we have suitable solution. */
brelse(bh);
- mutex_unlock(&dir->i_mutex);
- mutex_unlock(&src_parent->i_mutex);
+ inode_unlock(dir);
+ inode_unlock(src_parent);
ldiskfs_journal_stop(jh);
rc = -EEXIST;
GOTO(unlock, rc);
unlock:
- mutex_unlock(&dir->i_mutex);
- mutex_unlock(&src_parent->i_mutex);
+ inode_unlock(dir);
+ inode_unlock(src_parent);
ldiskfs_journal_stop(jh);
return rc;
}
statfs_pack(sfs, ksfs);
if (unlikely(sb->s_flags & MS_RDONLY))
sfs->os_state |= OS_STATE_READONLY;
- if (LDISKFS_HAS_INCOMPAT_FEATURE(sb,
- LDISKFS_FEATURE_INCOMPAT_EXTENTS))
+ if (ldiskfs_has_feature_extents(sb))
sfs->os_maxbytes = sb->s_maxbytes;
else
sfs->os_maxbytes = LDISKFS_SB(sb)->s_bitmap_maxbytes;
param->ddp_max_nlink = LDISKFS_LINK_MAX;
param->ddp_symlink_max = sb->s_blocksize;
param->ddp_mount_type = LDD_MT_LDISKFS;
- if (LDISKFS_HAS_INCOMPAT_FEATURE(sb, LDISKFS_FEATURE_INCOMPAT_EXTENTS))
+ if (ldiskfs_has_feature_extents(sb))
param->ddp_maxbytes = sb->s_maxbytes;
else
param->ddp_maxbytes = LDISKFS_SB(sb)->s_bitmap_maxbytes;
LDISKFS_XATTR_LEN(XATTR_NAME_MAX_LEN);
#if defined(LDISKFS_FEATURE_INCOMPAT_EA_INODE)
- if (LDISKFS_HAS_INCOMPAT_FEATURE(sb, LDISKFS_FEATURE_INCOMPAT_EA_INODE))
+ if (ldiskfs_has_feature_ea_inode(sb))
param->ddp_max_ea_size = LDISKFS_XATTR_MAX_LARGE_EA_SIZE -
ea_overhead;
else
LASSERT(!dt_object_remote(dt));
LASSERT(inode->i_op != NULL);
+#ifdef HAVE_IOP_XATTR
LASSERT(inode->i_op->getxattr != NULL);
+#endif
if (strcmp(name, XATTR_NAME_LOV) == 0 ||
strcmp(name, XATTR_NAME_DEFAULT_LMV) == 0)
/* Remove old PFID EA entry firstly. */
ll_vfs_dq_init(inode);
- rc = inode->i_op->removexattr(dentry, XATTR_NAME_FID);
+ rc = osd_removexattr(dentry, inode, XATTR_NAME_FID);
if (rc == -ENODATA) {
if ((fl & LU_XATTR_REPLACE) && !(fl & LU_XATTR_CREATE))
RETURN(rc);
LASSERT(!dt_object_remote(dt));
LASSERT(inode->i_op != NULL);
- LASSERT(inode->i_op->removexattr != NULL);
LASSERT(handle != NULL);
+#ifdef HAVE_IOP_XATTR
+ LASSERT(inode->i_op->removexattr != NULL);
+#endif
osd_trans_exec_op(env, handle, OSD_OT_XATTR_SET);
ll_vfs_dq_init(inode);
dentry->d_inode = inode;
dentry->d_sb = inode->i_sb;
- rc = inode->i_op->removexattr(dentry, name);
+ rc = osd_removexattr(dentry, inode, name);
}
osd_trans_exec_check(env, handle, OSD_OT_XATTR_SET);
struct osd_thread_info *info = osd_oti_get(env);
ENTRY;
- if (!LDISKFS_HAS_INCOMPAT_FEATURE(inode->i_sb,
- LDISKFS_FEATURE_INCOMPAT_DIRDATA))
+ if (!ldiskfs_has_feature_dirdata(inode->i_sb))
RETURN(0);
/* There is enough space to hold the FID-in-dirent. */
GOTO(out_mnt, rc = -EROFS);
}
- if (!LDISKFS_HAS_COMPAT_FEATURE(o->od_mnt->mnt_sb,
- LDISKFS_FEATURE_COMPAT_HAS_JOURNAL)) {
+ if (!ldiskfs_has_feature_journal(o->od_mnt->mnt_sb)) {
CERROR("%s: device %s is mounted w/o journal\n", name, dev);
GOTO(out_mnt, rc = -EINVAL);
}
#ifdef LDISKFS_MOUNT_DIRDATA
- if (LDISKFS_HAS_INCOMPAT_FEATURE(o->od_mnt->mnt_sb,
- LDISKFS_FEATURE_INCOMPAT_DIRDATA))
+ if (ldiskfs_has_feature_dirdata(o->od_mnt->mnt_sb))
LDISKFS_SB(osd_sb(o))->s_mount_opt |= LDISKFS_MOUNT_DIRDATA;
else if (strstr(name, "MDT")) /* don't complain for MGT or OSTs */
CWARN("%s: device %s was upgraded from Lustre-1.x without "
extern int ldiskfs_pdo;
+#ifndef HAVE_VFS_SETXATTR
+#define osd_setxattr(dentry, inode, name, buf, len, flag) \
+ ((inode)->i_op->setxattr(dentry, name, buf, len, flag))
+#define osd_getxattr(dentry, inode, name, buf, len) \
+ ((inode)->i_op->getxattr(dentry, name, buf, len))
+#define osd_removexattr(dentry, inode, name) \
+ ((inode)->i_op->removexattr(dentry, name))
+#else /* HAVE_VFS_SETXATTR */
+#define osd_setxattr(dentry, inode, name, buf, len, flag) \
+ __vfs_setxattr(dentry, inode, name, buf, len, flag)
+#define osd_getxattr(dentry, inode, name, buf, len) \
+ __vfs_getxattr(dentry, inode, name, buf, len)
+#define osd_removexattr(dentry, inode, name) \
+ __vfs_removexattr(dentry, name)
+#endif /* !HAVE_VFS_SETXATTR */
+
static inline int __osd_xattr_get(struct inode *inode, struct dentry *dentry,
const char *name, void *buf, int len)
{
dentry->d_inode = inode;
dentry->d_sb = inode->i_sb;
- return inode->i_op->getxattr(dentry, name, buf, len);
+ return osd_getxattr(dentry, inode, name, buf, len);
}
static inline int __osd_xattr_set(struct osd_thread_info *info,
ll_vfs_dq_init(inode);
dentry->d_inode = inode;
dentry->d_sb = inode->i_sb;
- return inode->i_op->setxattr(dentry, name, buf, buflen, fl);
+ return osd_setxattr(dentry, inode, name, buf, buflen, fl);
}
#ifdef CONFIG_PROC_FS
&osd->od_index_backup_stop, backup);
}
+#ifdef LDISKFS_HAS_INCOMPAT_FEATURE
+
+# ifdef LDISKFS_FEATURE_INCOMPAT_EXTENTS
+# define ldiskfs_has_feature_extents(sb) \
+ LDISKFS_HAS_INCOMPAT_FEATURE(sb, LDISKFS_FEATURE_INCOMPAT_EXTENTS)
+# endif
+# ifdef LDISKFS_FEATURE_INCOMPAT_EA_INODE
+# define ldiskfs_has_feature_ea_inode(sb) \
+ LDISKFS_HAS_INCOMPAT_FEATURE(sb, LDISKFS_FEATURE_INCOMPAT_EA_INODE)
+# endif
+# ifdef LDISKFS_FEATURE_INCOMPAT_DIRDATA
+# define ldiskfs_has_feature_dirdata(sb) \
+ LDISKFS_HAS_INCOMPAT_FEATURE(sb, LDISKFS_FEATURE_INCOMPAT_DIRDATA)
+# endif
+# ifdef LDISKFS_FEATURE_COMPAT_HAS_JOURNAL
+# define ldiskfs_has_feature_journal(sb) \
+ LDISKFS_HAS_COMPAT_FEATURE(sb, LDISKFS_FEATURE_COMPAT_HAS_JOURNAL)
+# endif
+# ifdef LDISKFS_FEATURE_RO_COMPAT_QUOTA
+# define ldiskfs_has_feature_quota(sb) \
+ LDISKFS_HAS_RO_COMPAT_FEATURE(sb, LDISKFS_FEATURE_RO_COMPAT_QUOTA)
+# endif
+# ifdef LDISKFS_FEATURE_RO_COMPAT_PROJECT
+# define ldiskfs_has_feature_project(sb) \
+ LDISKFS_HAS_RO_COMPAT_FEATURE(sb, LDISKFS_FEATURE_RO_COMPAT_PROJECT)
+# endif
+
+#endif
+
#endif /* _OSD_INTERNAL_H */
if (inode != NULL) {
if (LDISKFS_I(inode)->i_flags & LDISKFS_EXTENTS_FL)
return 1;
- } else if (LDISKFS_HAS_INCOMPAT_FEATURE(sb,
- LDISKFS_FEATURE_INCOMPAT_EXTENTS)) {
+ } else if (ldiskfs_has_feature_extents(sb)) {
return 1;
}
return 0;
ENTRY;
LASSERT(fid_is_acct(fid));
- if (!LDISKFS_HAS_RO_COMPAT_FEATURE(sb,
- LDISKFS_FEATURE_RO_COMPAT_QUOTA))
+ if (!ldiskfs_has_feature_quota(sb))
RETURN(-ENOENT);
id->oii_gen = OSD_OII_NOGEN;
break;
case PRJQUOTA:
#ifdef HAVE_PROJECT_QUOTA
- if (LDISKFS_HAS_RO_COMPAT_FEATURE(sb,
- LDISKFS_FEATURE_RO_COMPAT_PROJECT))
+ if (ldiskfs_has_feature_project(sb))
id->oii_ino =
le32_to_cpu(LDISKFS_SB(sb)->s_es->s_prj_quota_inum);
else
if (rc == sizeof(*ff)) {
/* 2) delete the old XATTR_NAME_FID */
ll_vfs_dq_init(inode);
- rc = inode->i_op->removexattr(dentry, XATTR_NAME_FID);
+ rc = osd_removexattr(dentry, inode, XATTR_NAME_FID);
if (rc)
GOTO(stop, rc);