From df4183e837baaf8256723474dc3c842863aab595 Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Mon, 13 Jan 2025 23:45:18 -0500 Subject: [PATCH] LU-17848 osd: move fid_is_fs_root() to lustre_fid.h Move the duplicate fid_is_fs_root() functions to the lustre_fid.h header. Test-Parameters: trivial Signed-off-by: Timothy Day Change-Id: I43d914dc28cf653deb0fa48228877c9dae503383 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57743 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Alex Zhuravlev Reviewed-by: James Simmons --- lustre/include/lustre_fid.h | 6 ++++++ lustre/osd-ldiskfs/osd_oi.c | 7 ------- lustre/osd-zfs/osd_oi.c | 7 ------- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/lustre/include/lustre_fid.h b/lustre/include/lustre_fid.h index 8a9b9db..d24fab9 100644 --- a/lustre/include/lustre_fid.h +++ b/lustre/include/lustre_fid.h @@ -278,6 +278,12 @@ static inline int fid_seq_in_fldb(u64 seq) fid_seq_is_root(seq) || fid_seq_is_dot(seq); } +static inline int fid_is_fs_root(const struct lu_fid *fid) +{ + return (unlikely(fid_seq(fid) == FID_SEQ_LOCAL_FILE && + fid_oid(fid) == OSD_FS_ROOT_OID)); +} + #ifdef HAVE_SERVER_SUPPORT static inline int fid_is_namespace_visible(const struct lu_fid *fid) { diff --git a/lustre/osd-ldiskfs/osd_oi.c b/lustre/osd-ldiskfs/osd_oi.c index fa05cac..d880828 100644 --- a/lustre/osd-ldiskfs/osd_oi.c +++ b/lustre/osd-ldiskfs/osd_oi.c @@ -506,13 +506,6 @@ void osd_oi_fini(struct osd_thread_info *info, struct osd_device *osd) osd->od_oi_table = NULL; } -static inline int fid_is_fs_root(const struct lu_fid *fid) -{ - /* Map root inode to special local object FID */ - return (unlikely(fid_seq(fid) == FID_SEQ_LOCAL_FILE && - fid_oid(fid) == OSD_FS_ROOT_OID)); -} - static int osd_oi_iam_lookup(struct osd_thread_info *oti, struct osd_oi *oi, struct dt_rec *rec, const struct dt_key *key) diff --git a/lustre/osd-zfs/osd_oi.c b/lustre/osd-zfs/osd_oi.c index 9e4fa8b..bfd8e3d 100644 --- a/lustre/osd-zfs/osd_oi.c +++ b/lustre/osd-zfs/osd_oi.c @@ -632,13 +632,6 @@ uint64_t osd_get_name_n_idx(const struct lu_env *env, struct osd_device *osd, return zapid; } -static inline int fid_is_fs_root(const struct lu_fid *fid) -{ - /* Map root inode to special local object FID */ - return fid_seq(fid) == FID_SEQ_LOCAL_FILE && - fid_oid(fid) == OSD_FS_ROOT_OID; -} - int osd_fid_lookup(const struct lu_env *env, struct osd_device *dev, const struct lu_fid *fid, uint64_t *oid) { -- 1.8.3.1