From: Fan Yong Date: Sat, 12 Jan 2013 00:40:24 +0000 (+0800) Subject: LU-1866 fid: cleanup object visibility definition and check X-Git-Tag: 2.3.61~58 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=204c513f80e91733dc6afbfc79417111caaaa5b3 LU-1866 fid: cleanup object visibility definition and check 1) The normal fid, IGIF fid, "ROOT" fid, ".lustre" fid are used for client-mdt visible objects. 2) Remove redundan osd_igif.{c,h} 3) Hide server-side local root for up layer dir readpage. 4) It is unnecessary to append FID-in-dient for dot name entry. Because we can get it from the directory object directly. Signed-off-by: Fan Yong Change-Id: If98de0c15c0cd3a0e93b666a8d48366b0d8a2cb0 Reviewed-on: http://review.whamcloud.com/4901 Reviewed-by: Mike Pershin Reviewed-by: Alex Zhuravlev Tested-by: Hudson Reviewed-by: Andreas Dilger Tested-by: Maloo --- diff --git a/lustre/fld/fld_handler.c b/lustre/fld/fld_handler.c index cc2bb42..309be8a 100644 --- a/lustre/fld/fld_handler.c +++ b/lustre/fld/fld_handler.c @@ -420,9 +420,10 @@ int fld_server_init(const struct lu_env *env, struct lu_server_fld *fld, fld->lsf_control_exp = NULL; - /* Insert reserved sequence number of ".lustre" into fld cache. */ if (lsr_flags == LU_SEQ_RANGE_MDT) { - range.lsr_start = FID_SEQ_DOT_LUSTRE; + /* Insert reserved sequence of "ROOT" and ".lustre" + * into fld cache. */ + range.lsr_start = FID_SEQ_LOCAL_FILE; range.lsr_end = FID_SEQ_DOT_LUSTRE + 1; range.lsr_index = 0; range.lsr_flags = lsr_flags; diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 060c252..d701085 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -704,21 +704,6 @@ static inline ino_t lu_igif_ino(const struct lu_fid *fid) } /** - * Build igif from the inode number/generation. - */ -#define LU_IGIF_BUILD(fid, ino, gen) \ -do { \ - fid->f_seq = ino; \ - fid->f_oid = gen; \ - fid->f_ver = 0; \ -} while(0) -static inline void lu_igif_build(struct lu_fid *fid, __u32 ino, __u32 gen) -{ - LU_IGIF_BUILD(fid, ino, gen); - LASSERT(fid_is_igif(fid)); -} - -/** * Get inode generation from a igif. * \param fid a igif to get inode generation from. * \return inode generation for the igif. @@ -728,6 +713,16 @@ static inline __u32 lu_igif_gen(const struct lu_fid *fid) return fid_oid(fid); } +/** + * Build igif from the inode number/generation. + */ +static inline void lu_igif_build(struct lu_fid *fid, __u32 ino, __u32 gen) +{ + fid->f_seq = ino; + fid->f_oid = gen; + fid->f_ver = 0; +} + /* * Fids are transmitted across network (in the sender byte-ordering), * and stored on disk in big-endian order. diff --git a/lustre/include/lustre_fid.h b/lustre/include/lustre_fid.h index d469035..2c490f6 100644 --- a/lustre/include/lustre_fid.h +++ b/lustre/include/lustre_fid.h @@ -249,6 +249,18 @@ static inline void lu_local_name_obj_fid(struct lu_fid *fid, __u32 oid) fid->f_ver = 0; } +static inline int fid_is_root(const struct lu_fid *fid) +{ + return unlikely(fid_seq(fid) == FID_SEQ_LOCAL_FILE && + fid_oid(fid) == MDD_ROOT_INDEX_OID); +} + +static inline int fid_is_dot_lustre(const struct lu_fid *fid) +{ + return unlikely(fid_seq(fid) == FID_SEQ_DOT_LUSTRE && + fid_oid(fid) == FID_OID_DOT_LUSTRE); +} + static inline int fid_is_otable_it(const struct lu_fid *fid) { return unlikely(fid_seq(fid) == FID_SEQ_LOCAL_FILE && @@ -268,6 +280,22 @@ static inline int fid_is_quota(const struct lu_fid *fid) fid_seq(fid) == FID_SEQ_QUOTA_GLB; } +static inline int fid_is_client_mdt_visible(const struct lu_fid *fid) +{ + const __u64 seq = fid_seq(fid); + + /* Here, we cannot distinguish whether the normal FID is for OST + * object or not. It is caller's duty to check more if needed. */ + return (!fid_is_last_id(fid) && + (fid_seq_is_norm(seq) || fid_seq_is_igif(seq))) || + fid_is_root(fid) || fid_is_dot_lustre(fid); +} + +static inline int fid_is_client_visible(const struct lu_fid *fid) +{ + return fid_is_client_mdt_visible(fid) || fid_is_idif(fid); +} + static inline void lu_last_id_fid(struct lu_fid *fid, __u64 seq) { if (fid_seq_is_mdt0(seq)) { diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c index b859e37..544d19c 100644 --- a/lustre/mdd/mdd_device.c +++ b/lustre/mdd/mdd_device.c @@ -744,12 +744,12 @@ static int dot_lustre_mdd_lookup(const struct lu_env *env, struct md_object *p, const struct lu_name *lname, struct lu_fid *f, struct md_op_spec *spec) { - if (strcmp(lname->ln_name, mdd_obf_dir_name) == 0) - *f = LU_OBF_FID; - else - return -ENOENT; + if (strcmp(lname->ln_name, mdd_obf_dir_name) == 0) { + *f = LU_OBF_FID; + return 0; + } - return 0; + return -ENOENT; } static mdl_mode_t dot_lustre_mdd_lock_mode(const struct lu_env *env, @@ -1084,6 +1084,7 @@ static int mdd_dot_lustre_setup(const struct lu_env *env, struct mdd_device *m) struct dt_object *dt_dot_lustre; struct lu_fid *fid = &mdd_env_info(env)->mti_fid; int rc; + ENTRY; rc = create_dot_lustre_dir(env, m); if (rc) diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 5f210b8..773940e 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -1077,6 +1077,19 @@ int mdd_unlink_sanity_check(const struct lu_env *env, struct mdd_object *pobj, RETURN(rc); } +static inline int mdd_declare_links_del(const struct lu_env *env, + struct mdd_object *c, + struct thandle *handle) +{ + int rc = 0; + + /* For directory, the linkEA will be removed together with the object. */ + if (!S_ISDIR(mdd_object_type(c))) + rc = mdd_declare_links_add(env, c, handle); + + return rc; +} + static int mdd_declare_unlink(const struct lu_env *env, struct mdd_device *mdd, struct mdd_object *p, struct mdd_object *c, const struct lu_name *name, struct md_attr *ma, @@ -1112,13 +1125,13 @@ static int mdd_declare_unlink(const struct lu_env *env, struct mdd_device *mdd, if (rc) return rc; - rc = mdd_declare_links_add(env, c, handle); - if (rc) - return rc; + rc = mdd_declare_links_del(env, c, handle); + if (rc != 0) + return rc; - rc = mdd_declare_changelog_store(env, mdd, name, handle); + rc = mdd_declare_changelog_store(env, mdd, name, handle); - return rc; + return rc; } static int mdd_unlink(const struct lu_env *env, struct md_object *pobj, @@ -1877,7 +1890,7 @@ cleanup: mdd_pdo_write_unlock(env, mdd_pobj, dlh); out_trans: - if (rc == 0) + if (rc == 0 && fid_is_client_mdt_visible(mdo2fid(son))) rc = mdd_changelog_ns_store(env, mdd, S_ISDIR(attr->la_mode) ? CL_MKDIR : S_ISREG(attr->la_mode) ? CL_CREATE : diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index b5e0d74..fb1b55c 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -5329,7 +5329,7 @@ static int mdt_fid2path(const struct lu_env *env, struct mdt_device *mdt, if (!fid_is_sane(&fp->gf_fid)) RETURN(-EINVAL); - if (!fid_is_norm(&fp->gf_fid) && !fid_is_igif(&fp->gf_fid)) { + if (!fid_is_client_mdt_visible(&fp->gf_fid)) { CWARN("%s: "DFID" is invalid, sequence should be " ">= "LPX64"\n", obd->obd_name, PFID(&fp->gf_fid), (__u64)FID_SEQ_NORMAL); diff --git a/lustre/osd-ldiskfs/Makefile.in b/lustre/osd-ldiskfs/Makefile.in index fda3f84..2757eb3 100644 --- a/lustre/osd-ldiskfs/Makefile.in +++ b/lustre/osd-ldiskfs/Makefile.in @@ -1,5 +1,5 @@ MODULES := osd_ldiskfs -osd_ldiskfs-objs := osd_handler.o osd_oi.o osd_igif.o osd_lproc.o osd_iam.o \ +osd_ldiskfs-objs := osd_handler.o osd_oi.o osd_lproc.o osd_iam.o \ osd_iam_lfix.o osd_iam_lvar.o osd_io.o osd_compat.o \ osd_scrub.o osd_quota.o osd_quota_fmt.o diff --git a/lustre/osd-ldiskfs/autoMakefile.am b/lustre/osd-ldiskfs/autoMakefile.am index 6b1f61e..84708ac 100644 --- a/lustre/osd-ldiskfs/autoMakefile.am +++ b/lustre/osd-ldiskfs/autoMakefile.am @@ -43,5 +43,5 @@ endif endif MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ -EXTRA_DIST := $(osd_ldiskfs-objs:%.o=%.c) osd_internal.h osd_oi.h osd_igif.h \ +EXTRA_DIST := $(osd_ldiskfs-objs:%.o=%.c) osd_internal.h osd_oi.h \ osd_iam.h osd_scrub.h osd_quota_fmt.h diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 8278c6b..495f4ba 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -63,12 +63,9 @@ #include /* struct ptlrpc_thread */ #include - -/* fid_is_local() */ #include #include "osd_internal.h" -#include "osd_igif.h" /* llo_* api support */ #include @@ -270,7 +267,10 @@ struct inode *osd_iget_fid(struct osd_thread_info *info, struct osd_device *dev, if (rc == 0) { *fid = lma->lma_self_fid; } else if (rc == -ENODATA) { - LU_IGIF_BUILD(fid, inode->i_ino, inode->i_generation); + if (unlikely(inode == osd_sb(dev)->s_root->d_inode)) + lu_local_obj_fid(fid, OSD_FS_ROOT_OID); + else + lu_igif_build(fid, inode->i_ino, inode->i_generation); } else { iput(inode); inode = ERR_PTR(rc); @@ -457,17 +457,17 @@ static int osd_object_init(const struct lu_env *env, struct lu_object *l, LINVRNT(osd_invariant(obj)); + if (fid_is_otable_it(&l->lo_header->loh_fid)) { + obj->oo_dt.do_ops = &osd_obj_otable_it_ops; + l->lo_header->loh_attr |= LOHA_EXISTS; + return 0; + } + result = osd_fid_lookup(env, obj, lu_object_fid(l), conf); obj->oo_dt.do_body_ops = &osd_body_ops_new; - if (result == 0) { - if (obj->oo_inode != NULL) { - osd_object_init0(obj); - } else if (fid_is_otable_it(&l->lo_header->loh_fid)) { - obj->oo_dt.do_ops = &osd_obj_otable_it_ops; - /* LFSCK iterator object is special without inode */ - l->lo_header->loh_attr |= LOHA_EXISTS; - } - } + if (result == 0 && obj->oo_inode != NULL) + osd_object_init0(obj); + LINVRNT(osd_invariant(obj)); return result; } @@ -2229,13 +2229,19 @@ static int osd_ea_fid_set(const struct lu_env *env, struct dt_object *dt, * its inmemory API. */ void osd_get_ldiskfs_dirent_param(struct ldiskfs_dentry_param *param, - const struct dt_rec *fid) + const struct dt_rec *fid) { - param->edp_magic = LDISKFS_LUFID_MAGIC; - param->edp_len = sizeof(struct lu_fid) + 1; + /* XXX: replace the check with "!fid_is_client_mdt_visible()" + * when FID in OI file introduced for local object. */ + if (!fid_is_norm((const struct lu_fid *)fid) && + !fid_is_igif((const struct lu_fid *)fid)) { + param->edp_magic = 0; + return; + } - fid_cpu_to_be((struct lu_fid *)param->edp_data, - (struct lu_fid *)fid); + param->edp_magic = LDISKFS_LUFID_MAGIC; + param->edp_len = sizeof(struct lu_fid) + 1; + fid_cpu_to_be((struct lu_fid *)param->edp_data, (struct lu_fid *)fid); } /** @@ -2801,7 +2807,7 @@ static int osd_index_try(const struct lu_env *env, struct dt_object *dt, } else if (unlikely(feat == &dt_otable_features)) { dt->do_index_ops = &osd_otable_ops; return 0; - } else if (feat == &dt_acct_features) { + } else if (unlikely(feat == &dt_acct_features)) { dt->do_index_ops = &osd_acct_index_ops; result = 0; skip_iam = 1; @@ -3285,27 +3291,20 @@ static int __osd_ea_add_rec(struct osd_thread_info *info, oth = container_of(th, struct osd_thandle, ot_super); LASSERT(oth->ot_handle != NULL); LASSERT(oth->ot_handle->h_transaction != NULL); - - child = osd_child_dentry_get(info->oti_env, pobj, name, strlen(name)); - - /* XXX: remove fid_is_igif() check here. - * IGIF check is just to handle insertion of .. when it is 'ROOT', - * it is IGIF now but needs FID in dir entry as well for readdir - * to work. - * LU-838 should fix that and remove fid_is_igif() check */ - if (fid_is_igif((struct lu_fid *)fid) || - fid_is_norm((struct lu_fid *)fid)) { - ldp = (struct ldiskfs_dentry_param *)info->oti_ldp; - osd_get_ldiskfs_dirent_param(ldp, fid); - child->d_fsdata = (void *)ldp; - } else { - child->d_fsdata = NULL; - } LASSERT(pobj->oo_inode); + + ldp = (struct ldiskfs_dentry_param *)info->oti_ldp; + if (unlikely(pobj->oo_inode == + osd_sb(osd_obj2dev(pobj))->s_root->d_inode)) + ldp->edp_magic = 0; + else + osd_get_ldiskfs_dirent_param(ldp, fid); + child = osd_child_dentry_get(info->oti_env, pobj, name, strlen(name)); + child->d_fsdata = (void *)ldp; ll_vfs_dq_init(pobj->oo_inode); - rc = osd_ldiskfs_add_entry(oth->ot_handle, child, cinode, hlock); + rc = osd_ldiskfs_add_entry(oth->ot_handle, child, cinode, hlock); - RETURN(rc); + RETURN(rc); } /** @@ -3346,31 +3345,25 @@ static int osd_add_dot_dotdot(struct osd_thread_info *info, result = 0; } } else if(strcmp(name, dotdot) == 0) { - dot_ldp = (struct ldiskfs_dentry_param *)info->oti_ldp; - dot_dot_ldp = (struct ldiskfs_dentry_param *)info->oti_ldp2; - - if (!dir->oo_compat_dot_created) - return -EINVAL; - if (!fid_is_igif((struct lu_fid *)dot_fid)) { - osd_get_ldiskfs_dirent_param(dot_ldp, dot_fid); - osd_get_ldiskfs_dirent_param(dot_dot_ldp, dot_dot_fid); - } else { - dot_ldp = NULL; - dot_dot_ldp = NULL; - } - /* in case of rename, dotdot is already created */ - if (dir->oo_compat_dotdot_created) { - return __osd_ea_add_rec(info, dir, parent_dir, name, - dot_dot_fid, NULL, th); - } - - result = ldiskfs_add_dot_dotdot(oth->ot_handle, parent_dir, - inode, dot_ldp, dot_dot_ldp); - if (result == 0) - dir->oo_compat_dotdot_created = 1; - } + if (!dir->oo_compat_dot_created) + return -EINVAL; + + dot_dot_ldp = (struct ldiskfs_dentry_param *)info->oti_ldp2; + osd_get_ldiskfs_dirent_param(dot_dot_ldp, dot_dot_fid); + /* in case of rename, dotdot is already created */ + if (dir->oo_compat_dotdot_created) + return __osd_ea_add_rec(info, dir, parent_dir, name, + dot_dot_fid, NULL, th); + + dot_ldp = (struct ldiskfs_dentry_param *)info->oti_ldp; + dot_ldp->edp_magic = 0; + result = ldiskfs_add_dot_dotdot(oth->ot_handle, parent_dir, + inode, dot_ldp, dot_dot_ldp); + if (result == 0) + dir->oo_compat_dotdot_created = 1; + } - return result; + return result; } @@ -3486,6 +3479,7 @@ static int osd_ea_lookup_rec(const struct lu_env *env, struct osd_object *obj, struct htree_lock *hlock = NULL; int ino; int rc; + ENTRY; LASSERT(dir->i_op != NULL && dir->i_op->lookup != NULL); @@ -4083,6 +4077,7 @@ static int osd_ldiskfs_filldir(char *buf, const char *name, int namelen, unsigned d_type) { struct osd_it_ea *it = (struct osd_it_ea *)buf; + struct osd_object *obj = it->oie_obj; struct osd_it_ea_dirent *ent = it->oie_dirent; struct lu_fid *fid = &ent->oied_fid; struct osd_fid_pack *rec; @@ -4098,16 +4093,23 @@ static int osd_ldiskfs_filldir(char *buf, const char *name, int namelen, OSD_IT_EA_BUFSIZE) RETURN(1); - if (d_type & LDISKFS_DIRENT_LUFID) { - rec = (struct osd_fid_pack*) (name + namelen + 1); - - if (osd_fid_unpack(fid, rec) != 0) - fid_zero(fid); + /* "." is just the object itself. */ + if (namelen == 1 && name[0] == '.') { + *fid = obj->oo_dt.do_lu.lo_header->loh_fid; + } else if (d_type & LDISKFS_DIRENT_LUFID) { + rec = (struct osd_fid_pack*) (name + namelen + 1); + if (osd_fid_unpack(fid, rec) != 0) + fid_zero(fid); + } else { + fid_zero(fid); + } + d_type &= ~LDISKFS_DIRENT_LUFID; - d_type &= ~LDISKFS_DIRENT_LUFID; - } else { - fid_zero(fid); - } + /* NOT export local root. */ + if (unlikely(osd_sb(osd_obj2dev(obj))->s_root->d_inode->i_ino == ino)) { + ino = obj->oo_inode->i_ino; + *fid = obj->oo_dt.do_lu.lo_header->loh_fid; + } ent->oied_ino = ino; ent->oied_off = offset; diff --git a/lustre/osd-ldiskfs/osd_igif.c b/lustre/osd-ldiskfs/osd_igif.c deleted file mode 100644 index de960e8..0000000 --- a/lustre/osd-ldiskfs/osd_igif.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - * - * Copyright (c) 2012, Intel Corporation. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - * - * lustre/osd/osd_igif.c - * - * igif (compatibility fids) support - * - * Author: Nikita Danilov - */ - -#define DEBUG_SUBSYSTEM S_MDS - -#include - -/* LUSTRE_VERSION_CODE */ -#include - -/* struct osd_inode_id */ -#include "osd_oi.h" -#include "osd_igif.h" -#include "osd_internal.h" - -/* fid stuff */ -#include - -void lu_igif_to_id(const struct lu_fid *fid, struct osd_inode_id *id) -{ - LASSERT(fid_is_igif(fid)); - osd_id_gen(id, lu_igif_ino(fid), lu_igif_gen(fid)); -} diff --git a/lustre/osd-ldiskfs/osd_igif.h b/lustre/osd-ldiskfs/osd_igif.h deleted file mode 100644 index 519edc9..0000000 --- a/lustre/osd-ldiskfs/osd_igif.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - * - * lustre/osd/osd_igif.h - * - * igif (compatibility fids) support - * - * Author: Nikita Danilov - */ - -#ifndef _OSD_IGIF_H -#define _OSD_IGIF_H - -#if defined(__KERNEL__) - -struct lu_fid; -struct osd_inode_id; - -void lu_igif_to_id(const struct lu_fid *fid, struct osd_inode_id *id); -void lu_igif_build(struct lu_fid *fid, __u32 ino, __u32 gen); - -#endif /* __KERNEL__ */ -#endif /* _OSD_IGIF_H */ diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index 3d5f893..cce3b12 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -698,7 +698,6 @@ static inline struct osd_oi *osd_fid2oi(struct osd_device *osd, { LASSERTF(!fid_is_idif(fid), DFID"\n", PFID(fid)); LASSERTF(!fid_is_last_id(fid), DFID"\n", PFID(fid)); - LASSERTF(!fid_is_igif(fid), DFID"\n", PFID(fid)); LASSERT(osd->od_oi_table != NULL && osd->od_oi_count >= 1); /* It can work even od_oi_count equals to 1 although it's unexpected, * the only reason we set it to 1 is for performance measurement */ diff --git a/lustre/osd-ldiskfs/osd_oi.c b/lustre/osd-ldiskfs/osd_oi.c index b625d82..43ba6e8 100644 --- a/lustre/osd-ldiskfs/osd_oi.c +++ b/lustre/osd-ldiskfs/osd_oi.c @@ -69,7 +69,6 @@ #include "osd_oi.h" /* osd_lookup(), struct osd_thread_info */ #include "osd_internal.h" -#include "osd_igif.h" #include "osd_scrub.h" static unsigned int osd_oi_count = OSD_OI_FID_NR; @@ -534,7 +533,7 @@ int osd_oi_lookup(struct osd_thread_info *info, struct osd_device *osd, /* FIXME: actually for all of the OST object */ rc = osd_obj_map_lookup(info, osd, fid, id); } else if (fid_is_igif(fid)) { - lu_igif_to_id(fid, id); + osd_id_gen(id, lu_igif_ino(fid), lu_igif_gen(fid)); } else if (fid_is_fs_root(fid)) { osd_id_gen(id, osd_sb(osd)->s_root->d_inode->i_ino, osd_sb(osd)->s_root->d_inode->i_generation); diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c index fbfdecf..41791f6 100644 --- a/lustre/osd-ldiskfs/osd_scrub.c +++ b/lustre/osd-ldiskfs/osd_scrub.c @@ -265,7 +265,7 @@ static int osd_scrub_prep(struct osd_device *dev) if (sf->sf_pos_last_checkpoint != 0) sf->sf_pos_latest_start = sf->sf_pos_last_checkpoint + 1; else - sf->sf_pos_latest_start = LDISKFS_FIRST_INO(osd_sb(dev)); + sf->sf_pos_latest_start = LDISKFS_FIRST_INO(osd_sb(dev)) + 1; scrub->os_pos_current = sf->sf_pos_latest_start; sf->sf_status = SS_SCANNING; @@ -1076,7 +1076,7 @@ int osd_scrub_setup(const struct lu_env *env, struct osd_device *dev) if (sf->sf_pos_last_checkpoint != 0) scrub->os_pos_current = sf->sf_pos_last_checkpoint + 1; else - scrub->os_pos_current = LDISKFS_FIRST_INO(sb); + scrub->os_pos_current = LDISKFS_FIRST_INO(sb) + 1; if (dirty != 0) { rc = osd_scrub_file_store(scrub); @@ -1364,8 +1364,8 @@ static int osd_otable_it_load(const struct lu_env *env, if (it->ooi_user_ready) return 0; - if (ooc->ooc_pos_preload < LDISKFS_FIRST_INO(osd_sb(dev))) - ooc->ooc_pos_preload = LDISKFS_FIRST_INO(osd_sb(dev)); + if (ooc->ooc_pos_preload <= LDISKFS_FIRST_INO(osd_sb(dev))) + ooc->ooc_pos_preload = LDISKFS_FIRST_INO(osd_sb(dev)) + 1; it->ooi_user_ready = 1; if (!scrub->os_full_speed) cfs_waitq_broadcast(&scrub->os_thread.t_ctl_waitq); diff --git a/lustre/osd-zfs/osd_object.c b/lustre/osd-zfs/osd_object.c index 96eca39..b4fd1d3 100644 --- a/lustre/osd-zfs/osd_object.c +++ b/lustre/osd-zfs/osd_object.c @@ -364,6 +364,12 @@ static int osd_object_init(const struct lu_env *env, struct lu_object *l, LASSERT(osd_invariant(obj)); + if (fid_is_otable_it(&l->lo_header->loh_fid)) { + obj->oo_dt.do_ops = &osd_obj_otable_it_ops; + l->lo_header->loh_attr |= LOHA_EXISTS; + RETURN(0); + } + rc = osd_fid_lookup(env, osd, lu_object_fid(l), &oid); if (rc == 0) { LASSERT(obj->oo_db == NULL); @@ -376,13 +382,6 @@ static int osd_object_init(const struct lu_env *env, struct lu_object *l, CERROR("%s: lookup "DFID"/"LPX64" failed: rc = %d\n", osd->od_svname, PFID(lu_object_fid(l)), oid, rc); } - } else if (rc == -ENOENT) { - if (fid_is_otable_it(&l->lo_header->loh_fid)) { - obj->oo_dt.do_ops = &osd_obj_otable_it_ops; - /* LFSCK iterator object is special without inode */ - l->lo_header->loh_attr |= LOHA_EXISTS; - } - rc = 0; } LASSERT(osd_invariant(obj)); RETURN(rc);