From 764904d4676640978e5225b50affd45cb5dc084c Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Thu, 4 Nov 2021 11:12:57 -0500 Subject: [PATCH] LU-17172 lov: include FID in some lov asserts Include the file FID in the assertions in lov_entry() and lov_mirror_entry(). Use these two functions more consistently in the lov layer. Signed-off-by: John L. Hammond Change-Id: I65978fe409842289c158021fb1b8042916d90e23 Reviewed-by: Andreas Dilger Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52602 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- lustre/lov/lov_cl_internal.h | 25 +++++++++++++++---------- lustre/lov/lov_io.c | 7 +++---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/lustre/lov/lov_cl_internal.h b/lustre/lov/lov_cl_internal.h index 7a85ed7..46ff22d 100644 --- a/lustre/lov/lov_cl_internal.h +++ b/lustre/lov/lov_cl_internal.h @@ -330,14 +330,9 @@ struct lov_object { struct task_struct *lo_owner; }; -static inline struct lov_layout_raid0 *lov_r0(struct lov_object *lov, int i) +static inline const struct lu_fid *lov_object_fid(const struct lov_object *lov) { - LASSERT(lov->lo_type == LLT_COMP); - LASSERTF(i < lov->u.composite.lo_entry_count, - "entry %d entry_count %d\n", i, - lov->u.composite.lo_entry_count); - - return &lov->u.composite.lo_entries[i].lle_raid0; + return lu_object_fid(&lov->lo_cl.co_lu); } static inline struct lov_stripe_md_entry *lov_lse(struct lov_object *lov, int i) @@ -365,12 +360,18 @@ static inline struct lov_layout_entry *lov_entry(struct lov_object *lov, int i) { LASSERT(lov->lo_type == LLT_COMP); LASSERTF(i < lov->u.composite.lo_entry_count, - "entry %d entry_count %d\n", i, - lov->u.composite.lo_entry_count); + DFID" entry %d, entry_count %d\n", + PFID(lov_object_fid(lov)), + i, lov->u.composite.lo_entry_count); return &lov->u.composite.lo_entries[i]; } +static inline struct lov_layout_raid0 *lov_r0(struct lov_object *lov, int i) +{ + return &lov_entry(lov, i)->lle_raid0; +} + #define lov_for_layout_entry(lov, entry, start, end) \ if (lov->u.composite.lo_entries && \ lov->u.composite.lo_entry_count > 0) \ @@ -387,7 +388,11 @@ static inline struct lov_layout_entry *lov_entry(struct lov_object *lov, int i) static inline struct lov_mirror_entry * lov_mirror_entry(struct lov_object *lov, int i) { - LASSERT(i < lov->u.composite.lo_mirror_count); + LASSERTF(i < lov->u.composite.lo_mirror_count, + DFID" entry %d, mirror_count %d\n", + PFID(lov_object_fid(lov)), + i, lov->u.composite.lo_mirror_count); + return &lov->u.composite.lo_mirrors[i]; } diff --git a/lustre/lov/lov_io.c b/lustre/lov/lov_io.c index bbca162..dbe5054 100644 --- a/lustre/lov/lov_io.c +++ b/lustre/lov/lov_io.c @@ -107,8 +107,7 @@ static void lov_io_sub_fini(const struct lu_env *env, struct lov_io *lio, static inline bool is_index_within_mirror(struct lov_object *lov, int index, int mirror_index) { - struct lov_layout_composite *comp = &lov->u.composite; - struct lov_mirror_entry *lre = &comp->lo_mirrors[mirror_index]; + struct lov_mirror_entry *lre = lov_mirror_entry(lov, mirror_index); return (index >= lre->lre_start && index <= lre->lre_end); } @@ -431,7 +430,7 @@ static int lov_io_mirror_init(struct lov_io *lio, struct lov_object *obj, struct lov_layout_entry *lle; bool found = false; - lre = &comp->lo_mirrors[(index + i) % comp->lo_mirror_count]; + lre = lov_mirror_entry(obj, (index + i) % comp->lo_mirror_count); if (!lre->lre_valid) continue; @@ -1992,7 +1991,7 @@ int lov_io_layout_at(struct lov_io *lio, __u64 offset) LASSERT(lio->lis_mirror_index >= 0); - lre = &comp->lo_mirrors[lio->lis_mirror_index]; + lre = lov_mirror_entry(lov, lio->lis_mirror_index); start_index = lre->lre_start; end_index = lre->lre_end; } -- 1.8.3.1