move common client helper function to lclient.
b=19688
o=adilger
r=tappro
r=ericm
int cl_local_size(struct inode *inode);
__u16 ll_dirent_type_get(struct lu_dirent *ent);
+ino_t cl_fid_build_ino(struct lu_fid *fid);
+__u32 cl_fid_build_gen(struct lu_fid *fid);
#ifdef INVARIANT_CHECK
# define CLOBINVRNT(env, clob, expr) \
/**
* UNIX file type is stored in S_IFMT bits.
*/
- LOHA_FT_START = 1 << 12, /**< S_IFIFO */
- LOHA_FT_END = 1 << 15, /**< S_IFREG */
+ LOHA_FT_START = 001 << 12, /**< S_IFIFO */
+ LOHA_FT_END = 017 << 12, /**< S_IFMT */
};
/**
/** special fid seq: used for .lustre objects. */
#define LU_DOT_LUSTRE_SEQ (FID_SEQ_START + 0x02ULL)
+/* Note that reserved SEQ numbers below 12 will conflict with ldiskfs
+ * inodes in the IGIF namespace, so these reserved SEQ numbers must be
+ * used sparingly until ldiskfs-based MDT backends and/or IGIF FIDs
+ * have been completely removed. */
+
/** special OID for local objects */
enum {
/** \see osd_oi_index_create */
}
return type;
}
+
+/**
+ * build inode number from passed @fid */
+ino_t cl_fid_build_ino(struct lu_fid *fid)
+{
+ ino_t ino;
+ ENTRY;
+
+ if (fid_is_igif(fid)) {
+ ino = lu_igif_ino(fid);
+ RETURN(ino);
+ }
+
+ /* Very stupid and having many downsides inode allocation algorithm
+ * based on fid. */
+ ino = fid_flatten(fid) & 0xFFFFFFFF;
+
+ if (unlikely(ino == 0))
+ /* the first result ino is 0xFFC001, so this is rarely used */
+ ino = 0xffbcde;
+ ino = ino | 0x80000000;
+ RETURN(ino);
+}
+
+/**
+ * build inode generation from passed @fid. If our FID overflows the 32-bit
+ * inode number then return a non-zero generation to distinguish them. */
+__u32 cl_fid_build_gen(struct lu_fid *fid)
+{
+ __u32 gen;
+ ENTRY;
+
+ if (fid_is_igif(fid)) {
+ gen = lu_igif_gen(fid);
+ RETURN(gen);
+ }
+
+ gen = (fid_flatten(fid) >> 32);
+ RETURN(gen);
+}
install-exec-hook:
endif
-libllite_a_SOURCES = llite_lib.c llite_fid.c super.c namei.c rw.c file.c dir.c \
+libllite_a_SOURCES = llite_lib.c super.c namei.c rw.c file.c dir.c \
lutil.c lutil.h llite_lib.h llite_cl.c \
../lclient/lcommon_cl.c ../lclient/glimpse.c ../lclient/lcommon_misc.c
# for make rpms -- need cleanup
-liblustre_a_SOURCES = llite_lib.c llite_fid.c super.c namei.c rw.c file.c dir.c \
+liblustre_a_SOURCES = llite_lib.c super.c namei.c rw.c file.c dir.c \
llite_lib.h llite_cl.c
liblustre.a : $(LUSTRE_LIBS) $(LND_LIBS) $(LNET_LIBS) $(SYSIO_LIBS) $(QUOTA_LIBS)
fid = ent->lde_fid;
name = ent->lde_name;
fid_le_to_cpu(&fid, &fid);
- ino = llu_fid_build_ino(llu_i2sbi(dir), &fid);
+ ino = cl_fid_build_ino(&fid);
type = ll_dirent_type_get(ent);
done = filldir(buf, nbytes, name, namelen,
(loff_t)hash, ino, type,
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program 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 GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * lustre/liblustre/llite_fid.c
- *
- * Lustre Light Super operations
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/queue.h>
-
-#ifdef HAVE_XTIO_H
-#include <xtio.h>
-#endif
-#include <sysio.h>
-#include <fs.h>
-#include <mount.h>
-#include <inode.h>
-#ifdef HAVE_FILE_H
-#include <file.h>
-#endif
-
-/* both sys/queue.h (libsysio require it) and portals/lists.h have definition
- * of 'LIST_HEAD'. undef it to suppress warnings
- */
-#undef LIST_HEAD
-#include <lnet/lnetctl.h> /* needed for parse_dump */
-
-#include "lutil.h"
-#include "llite_lib.h"
-#include <lustre_ver.h>
-#include <lustre_fid.h>
-
-/* build inode number on passed @fid */
-unsigned long llu_fid_build_ino(struct llu_sb_info *sbi,
- struct lu_fid *fid)
-{
- unsigned long ino;
- ENTRY;
-
- if (fid_is_igif(fid)) {
- ino = lu_igif_ino(fid);
- RETURN(ino);
- }
-
- ino = fid_flatten(fid);
-
- if (unlikely(ino == 0))
- /* the first result ino is 0xFFC001, so this is rarely used */
- ino = 0xffbcde;
- ino = ino | 0x80000000;
- RETURN(ino);
-}
MODULES := lustre llite_lloop
lustre-objs := dcache.o dir.o file.o llite_close.o llite_lib.o llite_nfs.o
-lustre-objs += llite_fid.o rw.o lproc_llite.o namei.o symlink.o llite_mmap.o
+lustre-objs += rw.o lproc_llite.o namei.o symlink.o llite_mmap.o
lustre-objs += xattr.o remote_perm.o llite_rmtacl.o llite_capa.o
lustre-objs += rw26.o super25.o statahead.o
lustre-objs += ../lclient/glimpse.o ../lclient/lcommon_cl.o ../lclient/lcommon_misc.o
{
struct inode *inode = filp->f_dentry->d_inode;
struct ll_inode_info *info = ll_i2info(inode);
- struct ll_sb_info *sbi = ll_i2sbi(inode);
__u64 pos = filp->f_pos;
struct page *page;
struct ll_dir_chain chain;
fid = ent->lde_fid;
name = ent->lde_name;
fid_le_to_cpu(&fid, &fid);
- ino = ll_fid_build_ino(sbi, &fid);
+ ino = cl_fid_build_ino(&fid);
type = ll_dirent_type_get(ent);
done = filldir(cookie, name, namelen,
(loff_t)hash, ino, type);
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program 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 GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * lustre/llite/llite_fid.c
- *
- * Lustre Light Super operations
- */
-
-#define DEBUG_SUBSYSTEM S_LLITE
-
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/random.h>
-#include <linux/version.h>
-
-#include <lustre_fid.h>
-#include <lustre_lite.h>
-#include <lustre_ha.h>
-#include <lustre_ver.h>
-#include <lustre_dlm.h>
-#include <lustre_disk.h>
-#include "llite_internal.h"
-
-/* Build inode number on passed @fid */
-ino_t ll_fid_build_ino(struct ll_sb_info *sbi,
- struct lu_fid *fid)
-{
- ino_t ino;
- ENTRY;
-
- if (fid_is_igif(fid)) {
- ino = lu_igif_ino(fid);
- RETURN(ino);
- }
-
- /*
- * Very stupid and having many downsides inode allocation algorithm
- * based on fid.
- */
- ino = fid_flatten(fid) & 0xFFFFFFFF;
-
- if (unlikely(ino == 0))
- /* the first result ino is 0xFFC001, so this is rarely used */
- ino = 0xffbcde;
- ino = ino | 0x80000000;
- RETURN(ino);
-}
-
-__u32 ll_fid_build_gen(struct ll_sb_info *sbi,
- struct lu_fid *fid)
-{
- __u32 gen = 0;
- ENTRY;
-
- if (fid_is_igif(fid)) {
- gen = lu_igif_gen(fid);
- }
- RETURN(gen);
-}
int ll_update_remote_perm(struct inode *inode, struct mdt_remote_perm *perm);
int lustre_check_remote_perm(struct inode *inode, int mask);
-/* llite/llite_fid.c */
-ino_t ll_fid_build_ino(struct ll_sb_info *sbi, struct lu_fid *fid);
-__u32 ll_fid_build_gen(struct ll_sb_info *sbi, struct lu_fid *fid);
-
/* llite/llite_capa.c */
extern cfs_timer_t ll_capa_timer;
}
LASSERT(fid_is_sane(&sbi->ll_root_fid));
- root = ll_iget(sb, ll_fid_build_ino(sbi, &sbi->ll_root_fid), &lmd);
+ root = ll_iget(sb, cl_fid_build_ino(&sbi->ll_root_fid), &lmd);
md_free_lustre_md(sbi->ll_md_exp, &lmd);
ptlrpc_req_finished(request);
spin_unlock(&lli->lli_lock);
}
#endif
- inode->i_ino = ll_fid_build_ino(sbi, &body->fid1);
- inode->i_generation = ll_fid_build_gen(sbi, &body->fid1);
+ inode->i_ino = cl_fid_build_ino(&body->fid1);
+ inode->i_generation = cl_fid_build_gen(&body->fid1);
if (body->valid & OBD_MD_FLATIME &&
body->atime > LTIME_S(inode->i_atime))
*/
LASSERT(fid_is_sane(&md.body->fid1));
- *inode = ll_iget(sb, ll_fid_build_ino(sbi, &md.body->fid1),&md);
+ *inode = ll_iget(sb, cl_fid_build_ino(&md.body->fid1), &md);
if (*inode == NULL || IS_ERR(*inode)) {
if (md.lsm)
obd_free_memmd(sbi->ll_dt_exp, &md.lsm);
struct inode *inode = NULL;
unsigned long valid = 0;
int eadatalen = 0;
- ino_t ino = ll_fid_build_ino(sbi, fid);
+ ino_t ino = cl_fid_build_ino(fid);
int rc;
ENTRY;
/*
* XXX: this is for create lsm object id, which should identify the lsm object
* unique in the whole mds, as I see. But it seems, we still not need it
- * now. Right? So just borrow the ll_fid_build_ino().
+ * now. Right? So just borrow the cl_fid_build_ino().
*/
static obd_id mdd_lov_create_id(const struct lu_fid *fid)
{