From 4938378c7e520ad21ec3bdcc6b799548cfd3e262 Mon Sep 17 00:00:00 2001 From: nikita Date: Wed, 12 Jul 2006 17:53:34 +0000 Subject: [PATCH] osd_igif: add igif handling functions. --- lustre/osd/Makefile.in | 2 +- lustre/osd/osd_igif.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++ lustre/osd/osd_igif.h | 44 +++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 lustre/osd/osd_igif.c create mode 100644 lustre/osd/osd_igif.h diff --git a/lustre/osd/Makefile.in b/lustre/osd/Makefile.in index 3953e3c..f20a829 100644 --- a/lustre/osd/Makefile.in +++ b/lustre/osd/Makefile.in @@ -1,5 +1,5 @@ MODULES := osd -osd-objs := osd_handler.o osd_oi.o +osd-objs := osd_handler.o osd_oi.o osd_igif.o EXTRA_PRE_CFLAGS := -I@LINUX@/fs -I@LUSTRE@ -I@LUSTRE@/ldiskfs diff --git a/lustre/osd/osd_igif.c b/lustre/osd/osd_igif.c new file mode 100644 index 0000000..b15f626 --- /dev/null +++ b/lustre/osd/osd_igif.c @@ -0,0 +1,75 @@ +/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- + * vim:expandtab:shiftwidth=8:tabstop=8: + * + * lustre/osd/osd_igif.c + * igif (compatibility fids) support + * + * Copyright (c) 2006 Cluster File Systems, Inc. + * Author: Nikita Danilov + * + * This file is part of the Lustre file system, http://www.lustre.org + * Lustre is a trademark of Cluster File Systems, Inc. + * + * You may have signed or agreed to another license before downloading + * this software. If so, you are bound by the terms and conditions + * of that agreement, and the following does not apply to you. See the + * LICENSE file included with this distribution for more information. + * + * If you did not agree to a different license, then this copy of Lustre + * is open source software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * In either case, Lustre 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 + * license text for more details. + */ + +#ifndef EXPORT_SYMTAB +# define EXPORT_SYMTAB +#endif +#define DEBUG_SUBSYSTEM S_MDS + +#include + +/* LUSTRE_VERSION_CODE */ +#include +/* fid stuff */ +#include + +/* struct osd_inode_id */ +#include "osd_oi.h" +#include "osd_igif.h" + +int lu_fid_is_igif(const struct lu_fid *fid) +{ + return fid_seq(fid) == LUSTRE_ROOT_FID_SEQ; +} + +void lu_igif_to_id(const struct lu_fid *fid, struct osd_inode_id *id) +{ + LASSERT(lu_fid_is_igif(fid)); + id->oii_ino = lu_igif_ino(fid); + id->oii_gen = lu_igif_gen(fid); +} + +__u32 lu_igif_ino(const struct lu_fid *fid) +{ + LASSERT(lu_fid_is_igif(fid)); + return fid_oid(fid); +} + +__u32 lu_igif_gen(const struct lu_fid *fid) +{ + LASSERT(lu_fid_is_igif(fid)); + return fid_ver(fid); +} + +void lu_igif_build(struct lu_fid *fid, __u32 ino, __u32 gen) +{ + fid->f_seq = LUSTRE_ROOT_FID_SEQ; + fid->f_oid = ino; + fid->f_ver = gen; + LASSERT(lu_fid_is_igif(fid)); +} diff --git a/lustre/osd/osd_igif.h b/lustre/osd/osd_igif.h new file mode 100644 index 0000000..d40e630 --- /dev/null +++ b/lustre/osd/osd_igif.h @@ -0,0 +1,44 @@ +/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- + * vim:expandtab:shiftwidth=8:tabstop=8: + * + * lustre/osd/osd_igif.h + * igif (compatibility fids) support + * + * Copyright (c) 2006 Cluster File Systems, Inc. + * Author: Nikita Danilov + * + * This file is part of the Lustre file system, http://www.lustre.org + * Lustre is a trademark of Cluster File Systems, Inc. + * + * You may have signed or agreed to another license before downloading + * this software. If so, you are bound by the terms and conditions + * of that agreement, and the following does not apply to you. See the + * LICENSE file included with this distribution for more information. + * + * If you did not agree to a different license, then this copy of Lustre + * is open source software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * In either case, Lustre 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 + * license text for more details. + */ + +#ifndef _OSD_IGIF_H +#define _OSD_IGIF_H + +#if defined(__KERNEL__) + +struct lu_fid; +struct osd_inode_id; + +int lu_fid_is_igif(const struct lu_fid *fid); +void lu_igif_to_id(const struct lu_fid *fid, struct osd_inode_id *id); +__u32 lu_igif_ino(const struct lu_fid *fid); +__u32 lu_igif_gen(const struct lu_fid *fid); +void lu_igif_build(struct lu_fid *fid, __u32 ino, __u32 gen); + +#endif /* __KERNEL__ */ +#endif /* _OSD_IGIF_H */ -- 1.8.3.1