X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fosd-ldiskfs%2Fosd_compat.c;h=4794d78f750d7dcd21f00f1daf1326c21630c951;hp=806fcc00cd968e578603f8c06285ef428b5d8df9;hb=ef1b815d77ae717f3ee701e2392fd3fe6c71906d;hpb=4e7541ab2328da4d57f60b3b4d6514990f996858;ds=sidebyside diff --git a/lustre/osd-ldiskfs/osd_compat.c b/lustre/osd-ldiskfs/osd_compat.c index 806fcc0..4794d78 100644 --- a/lustre/osd-ldiskfs/osd_compat.c +++ b/lustre/osd-ldiskfs/osd_compat.c @@ -27,7 +27,7 @@ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2013, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -192,6 +192,7 @@ static int osd_mdt_init(const struct lu_env *env, struct osd_device *dev) if (IS_ERR(d)) GOTO(cleanup, rc = PTR_ERR(d)); + ldiskfs_set_inode_state(d->d_inode, LDISKFS_STATE_LUSTRE_NO_OI); omm->omm_remote_parent = d; /* Set LMA for remote parent inode */ @@ -255,6 +256,8 @@ int osd_add_to_remote_parent(const struct lu_env *env, struct osd_device *osd, mutex_lock(&parent->d_inode->i_mutex); rc = osd_ldiskfs_add_entry(oh->ot_handle, dentry, obj->oo_inode, NULL); + CDEBUG(D_INODE, "%s: add %s:%lu to remote parent %lu.\n", osd_name(osd), + name, obj->oo_inode->i_ino, parent->d_inode->i_ino); LASSERTF(parent->d_inode->i_nlink > 1, "%s: %lu nlink %d", osd_name(osd), parent->d_inode->i_ino, parent->d_inode->i_nlink); @@ -297,6 +300,8 @@ int osd_delete_from_remote_parent(const struct lu_env *env, mutex_unlock(&parent->d_inode->i_mutex); RETURN(-ENOENT); } + CDEBUG(D_INODE, "%s: el %s:%lu to remote parent %lu.\n", osd_name(osd), + name, obj->oo_inode->i_ino, parent->d_inode->i_ino); rc = ldiskfs_delete_entry(oh->ot_handle, parent->d_inode, de, bh); LASSERTF(parent->d_inode->i_nlink > 1, "%s: %lu nlink %d", osd_name(osd), parent->d_inode->i_ino, @@ -305,6 +310,12 @@ int osd_delete_from_remote_parent(const struct lu_env *env, mark_inode_dirty(parent->d_inode); mutex_unlock(&parent->d_inode->i_mutex); brelse(bh); + + /* Get rid of REMOTE_PARENT flag from incompat */ + lma->lma_incompat &= ~LMAI_REMOTE_PARENT; + lustre_lma_swab(lma); + rc = __osd_xattr_set(oti, obj->oo_inode, XATTR_NAME_LMA, lma, + sizeof(*lma), XATTR_REPLACE); RETURN(rc); } @@ -691,16 +702,16 @@ int osd_obj_map_lookup(struct osd_thread_info *info, struct osd_device *dev, LASSERT(map); LASSERT(map->om_root); - fid_ostid_pack(fid, ostid); - osd_seq = osd_seq_load(dev, ostid->oi_seq); + fid_to_ostid(fid, ostid); + osd_seq = osd_seq_load(dev, ostid_seq(ostid)); if (IS_ERR(osd_seq)) RETURN(PTR_ERR(osd_seq)); - dirn = ostid->oi_id & (osd_seq->oos_subdir_count - 1); + dirn = ostid_id(ostid) & (osd_seq->oos_subdir_count - 1); d_seq = osd_seq->oos_dirs[dirn]; LASSERT(d_seq); - osd_oid_name(name, fid, ostid->oi_id); + osd_oid_name(name, fid, ostid_id(ostid)); child = &info->oti_child_dentry; child->d_parent = d_seq; @@ -746,17 +757,17 @@ int osd_obj_map_insert(struct osd_thread_info *info, LASSERT(map); /* map fid to seq:objid */ - fid_ostid_pack(fid, ostid); + fid_to_ostid(fid, ostid); - osd_seq = osd_seq_load(osd, ostid->oi_seq); + osd_seq = osd_seq_load(osd, ostid_seq(ostid)); if (IS_ERR(osd_seq)) RETURN(PTR_ERR(osd_seq)); - dirn = ostid->oi_id & (osd_seq->oos_subdir_count - 1); + dirn = ostid_id(ostid) & (osd_seq->oos_subdir_count - 1); d = osd_seq->oos_dirs[dirn]; LASSERT(d); - osd_oid_name(name, fid, ostid->oi_id); + osd_oid_name(name, fid, ostid_id(ostid)); rc = osd_obj_add_entry(info, osd, d, name, id, th); RETURN(rc); @@ -777,17 +788,17 @@ int osd_obj_map_delete(struct osd_thread_info *info, struct osd_device *osd, LASSERT(map); /* map fid to seq:objid */ - fid_ostid_pack(fid, ostid); + fid_to_ostid(fid, ostid); - osd_seq = osd_seq_load(osd, ostid->oi_seq); + osd_seq = osd_seq_load(osd, ostid_seq(ostid)); if (IS_ERR(osd_seq)) GOTO(cleanup, rc = PTR_ERR(osd_seq)); - dirn = ostid->oi_id & (osd_seq->oos_subdir_count - 1); + dirn = ostid_id(ostid) & (osd_seq->oos_subdir_count - 1); d = osd_seq->oos_dirs[dirn]; LASSERT(d); - osd_oid_name(name, fid, ostid->oi_id); + osd_oid_name(name, fid, ostid_id(ostid)); rc = osd_obj_del_entry(info, osd, d, name, th); cleanup: RETURN(rc);