From d2c75834acc9ee067ced66ecd3d88157eddc7aec Mon Sep 17 00:00:00 2001 From: nikita Date: Tue, 31 Oct 2006 18:23:07 +0000 Subject: [PATCH] osd: remove oi lock: it is no longer needed now that we have iam-pdirops. --- lustre/osd/osd_handler.c | 6 ------ lustre/osd/osd_oi.c | 35 +---------------------------------- lustre/osd/osd_oi.h | 9 --------- 3 files changed, 1 insertion(+), 49 deletions(-) diff --git a/lustre/osd/osd_handler.c b/lustre/osd/osd_handler.c index 2dbbe39..c145091 100644 --- a/lustre/osd/osd_handler.c +++ b/lustre/osd/osd_handler.c @@ -446,9 +446,7 @@ static int osd_inode_remove(const struct lu_env *env, struct osd_object *obj) OSD_TXN_INODE_DELETE_CREDITS; th = osd_trans_start(env, &osd->od_dt_dev, prm); if (!IS_ERR(th)) { - osd_oi_write_lock(&osd->od_oi); result = osd_oi_delete(oti, &osd->od_oi, fid, th); - osd_oi_write_unlock(&osd->od_oi); osd_trans_stop(env, th); } else result = PTR_ERR(th); @@ -1199,9 +1197,7 @@ static int osd_object_create(const struct lu_env *env, struct dt_object *dt, id->oii_ino = obj->oo_inode->i_ino; id->oii_gen = obj->oo_inode->i_generation; - osd_oi_write_lock(&osd->od_oi); result = osd_oi_insert(info, &osd->od_oi, fid, id, th); - osd_oi_write_unlock(&osd->od_oi); } LASSERT(ergo(result == 0, dt_object_exists(dt))); @@ -2268,7 +2264,6 @@ static int osd_fid_lookup(const struct lu_env *env, if (OBD_FAIL_CHECK(OBD_FAIL_OST_ENOENT)) RETURN(-ENOENT); - osd_oi_read_lock(oi); result = osd_oi_lookup(info, oi, fid, id); if (result == 0) { inode = osd_iget(info, dev, id); @@ -2287,7 +2282,6 @@ static int osd_fid_lookup(const struct lu_env *env, result = PTR_ERR(inode); } else if (result == -ENOENT) result = 0; - osd_oi_read_unlock(oi); LASSERT(osd_invariant(obj)); RETURN(result); } diff --git a/lustre/osd/osd_oi.c b/lustre/osd/osd_oi.c index fa06632..24672a9 100644 --- a/lustre/osd/osd_oi.c +++ b/lustre/osd/osd_oi.c @@ -79,11 +79,6 @@ int osd_oi_init(struct osd_thread_info *info, const struct lu_env *env; env = info->oti_env; - /* - * Initialize ->oi_lock first, because of possible oi re-entrance in - * dt_store_open(). - */ - init_rwsem(&oi->oi_lock); obj = dt_store_open(env, dev, oi_dirname, &info->oti_fid); if (!IS_ERR(obj)) { @@ -110,26 +105,6 @@ void osd_oi_fini(struct osd_thread_info *info, struct osd_oi *oi) } } -void osd_oi_read_lock(struct osd_oi *oi) -{ - down_read(&oi->oi_lock); -} - -void osd_oi_read_unlock(struct osd_oi *oi) -{ - up_read(&oi->oi_lock); -} - -void osd_oi_write_lock(struct osd_oi *oi) -{ - down_write(&oi->oi_lock); -} - -void osd_oi_write_unlock(struct osd_oi *oi) -{ - up_write(&oi->oi_lock); -} - static const struct dt_key *oi_fid_key(struct osd_thread_info *info, const struct lu_fid *fid) { @@ -155,9 +130,7 @@ static inline void oid_insert_init(struct osd_inode_id *id, id->oii_ino = cpu_to_be64(ino); id->oii_gen = cpu_to_be32(gen); } -/* - * Locking: requires at least read lock on oi. - */ + int osd_oi_lookup(struct osd_thread_info *info, struct osd_oi *oi, const struct lu_fid *fid, struct osd_inode_id *id) { @@ -176,9 +149,6 @@ int osd_oi_lookup(struct osd_thread_info *info, struct osd_oi *oi, return rc; } -/* - * Locking: requires write lock on oi. - */ int osd_oi_insert(struct osd_thread_info *info, struct osd_oi *oi, const struct lu_fid *fid, const struct osd_inode_id *id0, struct thandle *th) @@ -200,9 +170,6 @@ int osd_oi_insert(struct osd_thread_info *info, struct osd_oi *oi, BYPASS_CAPA); } -/* - * Locking: requires write lock on oi. - */ int osd_oi_delete(struct osd_thread_info *info, struct osd_oi *oi, const struct lu_fid *fid, struct thandle *th) diff --git a/lustre/osd/osd_oi.h b/lustre/osd/osd_oi.h index f26cd28..a6811e4 100644 --- a/lustre/osd/osd_oi.h +++ b/lustre/osd/osd_oi.h @@ -56,10 +56,6 @@ struct osd_oi { * underlying index object, where fid->id mapping in stored. */ struct dt_object *oi_dir; - /* - * semaphore, synchronizing access to oi. - */ - struct rw_semaphore oi_lock; }; /* @@ -79,11 +75,6 @@ int osd_oi_init(struct osd_thread_info *info, struct osd_oi *oi, struct dt_device *dev); void osd_oi_fini(struct osd_thread_info *info, struct osd_oi *oi); -void osd_oi_read_lock(struct osd_oi *oi); -void osd_oi_read_unlock(struct osd_oi *oi); -void osd_oi_write_lock(struct osd_oi *oi); -void osd_oi_write_unlock(struct osd_oi *oi); - int osd_oi_lookup(struct osd_thread_info *info, struct osd_oi *oi, const struct lu_fid *fid, struct osd_inode_id *id); int osd_oi_insert(struct osd_thread_info *info, struct osd_oi *oi, -- 1.8.3.1