Whamcloud - gitweb
LU-17172 lov: include FID in some lov asserts 02/52602/3
authorJohn L. Hammond <jhammond@whamcloud.com>
Thu, 4 Nov 2021 16:12:57 +0000 (11:12 -0500)
committerOleg Drokin <green@whamcloud.com>
Thu, 18 Jan 2024 06:16:14 +0000 (06:16 +0000)
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 <jhammond@whamcloud.com>
Change-Id: I65978fe409842289c158021fb1b8042916d90e23
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52602
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lov/lov_cl_internal.h
lustre/lov/lov_io.c

index 7a85ed7..46ff22d 100644 (file)
@@ -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];
 }
 
index bbca162..dbe5054 100644 (file)
@@ -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;
        }