static smfs_pack_rec_func smfs_get_rec_pack_type(struct super_block *sb)
{
- int idx = 0;
struct smfs_super_info *smsi = S2SMI(sb);
- idx = GET_REC_PACK_TYPE_INDEX(smsi->smsi_flags);
- return smsi->smsi_pack_rec[idx];
+ int index = GET_REC_PACK_TYPE_INDEX(smsi->smsi_flags);
+
+ return smsi->smsi_pack_rec[index];
}
static int smfs_post_kml_rec(struct inode *dir, void *de, void *data1,
}
#define KML_HOOK "kml_hook"
-
int smfs_rec_init(struct super_block *sb)
{
- int rc = 0;
struct smfs_super_info *smfs_info = S2SMI(sb);
struct smfs_hook_ops *rec_hops = NULL;
+ int rc = 0;
SMFS_SET_REC(smfs_info);
- rc = ost_rec_pack_init(smfs_info);
- if (rc)
- return rc;
-
- rc = mds_rec_pack_init(smfs_info);
- if (rc)
- return rc;
+ ost_rec_pack_init(smfs_info);
+ mds_rec_pack_init(smfs_info);
rec_hops = smfs_alloc_hook_ops(KML_HOOK, NULL, smfs_rec_post_hook);
if (!rec_hops) {
RETURN(rc);
}
-static inline void copy_inode_attr(struct iattr *iattr,
- struct inode *inode)
+static inline void copy_inode_attr(struct iattr *iattr, struct inode *inode)
{
iattr->ia_mode = inode->i_mode;
iattr->ia_uid = inode->i_uid;
OBD_ALLOC(*p_buffer, *size + args_len + 1);
if (!*p_buffer)
RETURN(-ENOMEM);
-
- /* first copy reint dir. */
+ /*First copy reint dir */
if (args_data)
memcpy(*p_buffer, args_data, args_len);
- /* then copy the node name. */
+ /*then copy the node name */
memcpy(*p_buffer + args_len,
(in_data + sizeof(int)), *size);
{
int offset = *(int *)(record);
char *tmp = record + offset + sizeof(int);
-
+ int rc = 0;
*opcode = *(int *)tmp;
*pbuf = tmp + sizeof(*opcode);
-
- return 0;
+ RETURN(rc);
}
EXPORT_SYMBOL(smfs_rec_unpack);
}
EXPORT_SYMBOL(smfs_rec_setattr);
-int smfs_rec_md(struct inode *inode, void *lmm, int lmm_size)
+int smfs_rec_md(struct inode *inode, void * lmm, int lmm_size)
{
char *set_lmm = NULL;
int rc = 0;
if (SMFS_DO_REINT_REC(flags)) {
struct llog_gen_rec *lgr;
- /* for reint rec, we need insert a gen rec to identify
- * the end of the rec.*/
+ /*For reint rec, we need insert
+ *a gen rec to identify the end
+ *of the rec.*/
OBD_ALLOC(lgr, sizeof(*lgr));
if (!lgr)
RETURN(-ENOMEM);
return rc;
}
-int smfs_post_rec_create(struct inode *dir, struct dentry *dentry,
- void *data1, void *data2)
+int smfs_post_rec_create(struct inode *dir, struct dentry *dentry, void *data1,
+ void *data2)
{
struct smfs_super_info *sinfo;
char *buffer = NULL, *pbuf;
static int smfs_post_rec_link(struct inode *dir, struct dentry *dentry,
void *data1, void *data2)
{
- struct dentry *new_dentry = (struct dentry *)data1;
- int rc = 0, length = 0, buf_len = 0;
- char *buffer = NULL, *pbuf = NULL;
struct smfs_super_info *sinfo;
+ struct dentry *old_dentry = (struct dentry *)data1;
+ char *buffer = NULL, *pbuf = NULL;
+ int rc = 0, length = 0, buf_len = 0;
sinfo = S2SMI(dir->i_sb);
if (!sinfo)
buf_len = PAGE_SIZE;
KML_BUF_REC_INIT(buffer, pbuf, buf_len);
-
rc = smfs_log_path(dir->i_sb, dentry, pbuf, buf_len);
if (rc < 0)
GOTO(exit, rc);
length = rc;
KML_BUF_REC_END(buffer, length, pbuf);
- rc = smfs_pack_rec(pbuf, dentry, dir, dentry,
- new_dentry, REINT_LINK);
+ rc = smfs_pack_rec(pbuf, dentry, dir, dentry->d_parent,
+ old_dentry->d_parent, REINT_LINK);
if (rc <= 0)
GOTO(exit, rc);
-
- length += rc;
- rc = smfs_llog_add_rec(sinfo, (void *)buffer, length);
+ else
+ length += rc;
+ rc = smfs_llog_add_rec(sinfo, (void*)buffer, length);
exit:
if (buffer)
OBD_FREE(buffer, PAGE_SIZE);
pbuf += rc;
length += rc;
- buf_len -= rc;
-
- /* record new_dentry path. */
+ buf_len -= rc;
+ /*record new_dentry path*/
rc = smfs_log_path(dir->i_sb, new_dentry, pbuf, buf_len);
if (rc < 0)
GOTO(exit, rc);