Whamcloud - gitweb
LU-2158 lvfs: remove the fsfilt and lvfs layer 12/5512/15
authorJames Simmons <uja.ornl@gmail.com>
Fri, 27 Sep 2013 14:24:42 +0000 (10:24 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 25 Oct 2013 01:41:30 +0000 (01:41 +0000)
The fsfilt/lvfs layer has been obsoleted by the osd
layer. This patch moves the remaining fsfilt code
related to ldiskfs to osd-ldiskfs where it belongs.
The remaining bits of the lvfs code it moved to the
ptlrpc layer where it is used. The last of the procfs
code is integrated into the obdclass layer as well.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Change-Id: Ie72103639fbcbbcedd0f810ac68044b38a0f0b65
Reviewed-on: http://review.whamcloud.com/5512
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
43 files changed:
lnet/utils/debug.c
lustre.spec.in
lustre/Makefile.in
lustre/autoMakefile.am
lustre/autoconf/lustre-core.m4
lustre/include/Makefile.am
lustre/include/cl_object.h
lustre/include/darwin/Makefile.am
lustre/include/darwin/lustre_fsfilt.h [deleted file]
lustre/include/linux/Makefile.am
lustre/include/linux/lustre_fsfilt.h [deleted file]
lustre/include/linux/lvfs_linux.h
lustre/include/linux/obd_support.h
lustre/include/lustre_fsfilt.h [deleted file]
lustre/include/lustre_lib.h
lustre/include/lvfs.h
lustre/include/obd.h
lustre/liblustre/Makefile.am
lustre/liblustre/genlib.sh
lustre/lvfs/.gitignore [deleted file]
lustre/lvfs/Makefile.in [deleted file]
lustre/lvfs/autoMakefile.am [deleted file]
lustre/lvfs/fsfilt.c [deleted file]
lustre/lvfs/fsfilt_ext3.c [deleted file]
lustre/lvfs/lvfs_linux.c [deleted file]
lustre/obdclass/Makefile.in
lustre/obdclass/autoMakefile.am
lustre/obdclass/class_obd.c
lustre/obdclass/lprocfs_counters.c [moved from lustre/lvfs/lvfs_lib.c with 73% similarity]
lustre/obdclass/lprocfs_status.c
lustre/obdclass/obd_mount.c
lustre/obdclass/obd_mount_server.c
lustre/ofd/ofd_fs.c
lustre/osd-ldiskfs/osd_compat.c
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_internal.h
lustre/osd-ldiskfs/osd_io.c
lustre/ptlrpc/Makefile.in
lustre/ptlrpc/autoMakefile.am
lustre/ptlrpc/sec_ctx.c [new file with mode: 0644]
lustre/scripts/lnet
lustre/tests/sanity.sh
lustre/tests/test-framework.sh

index f975866..5bfee30 100644 (file)
@@ -856,7 +856,6 @@ static struct mod_paths {
        { "kralnd", "lnet/klnds/ralnd" },
        { "ksocklnd", "lnet/klnds/socklnd" },
        { "ktdilnd", "lnet/klnds/tdilnd" },
-       { "lvfs", "lustre/lvfs" },
        { "obdclass", "lustre/obdclass" },
        { "llog_test", "lustre/obdclass" },
        { "ptlrpc_gss", "lustre/ptlrpc/gss" },
@@ -875,7 +874,6 @@ static struct mod_paths {
        { "obdfilter", "lustre/obdfilter" },
        { "lov", "lustre/lov" },
        { "lmv", "lustre/lmv" },
-       { "fsfilt_ldiskfs", "lustre/lvfs" },
        { "lquota", "lustre/quota" },
        { "mgs", "lustre/mgs" },
        { "mgc", "lustre/mgc" },
index 5c00be7..e9b3bc2 100644 (file)
@@ -425,7 +425,6 @@ find $RPM_BUILD_ROOT%{?rootdir}/lib/modules/%{kversion}/updates -name "*.ko" -ty
 %endif
 %if %{with ldiskfs}
 %exclude %{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/ldiskfs.ko
-%exclude %{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/fsfilt_ldiskfs.ko
 %exclude %{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_ldiskfs.ko
 %endif
 %if %{with zfs}
@@ -441,7 +440,6 @@ find $RPM_BUILD_ROOT%{?rootdir}/lib/modules/%{kversion}/updates -name "*.ko" -ty
 %if %{with ldiskfs}
 %files osd-ldiskfs
 %attr(-, root, root) %{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/ldiskfs.ko
-%attr(-, root, root) %{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/fsfilt_ldiskfs.ko
 %attr(-, root, root) %{?rootdir}/lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_ldiskfs.ko
 %if %{defined rpm_post_base}
 %attr(0555, root, root) %{rpm_post_base}-osd-ldiskfs.sh
index 732a9d8..2794a62 100644 (file)
@@ -1,5 +1,4 @@
 subdir-m += fid
-subdir-m += lvfs
 subdir-m += obdclass
 subdir-m += ptlrpc
 subdir-m += obdecho
index f98e398..039bcc6 100644 (file)
@@ -39,7 +39,7 @@
 AUTOMAKE_OPTIONS = foreign
 
 # also update lustre/autoconf/lustre-core.m4 AC_CONFIG_FILES
-ALWAYS_SUBDIRS = include lvfs obdclass ldlm ptlrpc obdecho \
+ALWAYS_SUBDIRS = include obdclass ldlm ptlrpc obdecho \
        mgc fid fld doc utils tests scripts autoconf contrib conf
 
 SERVER_SUBDIRS = ost mgs mdt mdd ofd osd-zfs osd-ldiskfs \
@@ -72,10 +72,7 @@ DIST_SUBDIRS := $(ALWAYS_SUBDIRS) $(SERVER_SUBDIRS) $(CLIENT_SUBDIRS)        \
 
 EXTRA_DIST = BUGS FDL kernel_patches BUILDING
 
-lvfs-sources:
-       $(MAKE) sources -C lvfs
-
-sources: $(LDISKFS) lvfs-sources lustre_build_version
+sources: $(LDISKFS) lustre_build_version
 
 all-recursive: lustre_build_version
 
index 620963c..7f37312 100644 (file)
@@ -866,26 +866,6 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
-# 3.1.1 has ext4_blocks_for_truncate
-#
-AC_DEFUN([LC_BLOCKS_FOR_TRUNCATE],
-[AC_MSG_CHECKING([if kernel has ext4_blocks_for_truncate])
-LB_LINUX_TRY_COMPILE([
-       #include <linux/fs.h>
-       #include "$LINUX/fs/ext4/ext4_jbd2.h"
-       #include "$LINUX/fs/ext4/truncate.h"
-],[
-       ext4_blocks_for_truncate(NULL);
-],[
-       AC_MSG_RESULT([yes])
-       AC_DEFINE(HAVE_BLOCKS_FOR_TRUNCATE, 1,
-                 [kernel has ext4_blocks_for_truncate])
-],[
-       AC_MSG_RESULT([no])
-])
-])
-
-#
 # 3.1 introduced generic_file_llseek_size()
 #
 AC_DEFUN([LC_FILE_LLSEEK_SIZE],
@@ -1350,9 +1330,6 @@ AC_DEFUN([LC_PROG_LINUX],
         LC_FILE_LLSEEK_SIZE
         LC_INODE_PERMISION_2ARGS
 
-        # 3.1.1
-        LC_BLOCKS_FOR_TRUNCATE
-
         # 3.2
         LC_HAVE_VOID_MAKE_REQUEST_FN
         LC_HAVE_PROTECT_I_NLINK
@@ -1630,7 +1607,7 @@ AC_CHECK_FUNCS([inet_ntoa])
 # libsysio/src/readlink.c
 LC_READLINK_SSIZE_T
 
-# lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
+# libcfs prng.c - depends on linux/types.h from liblustre/dir.c
 AC_CHECK_HEADERS([linux/random.h], [], [],
                  [#ifdef HAVE_LINUX_TYPES_H
                   # include <linux/types.h>
@@ -1779,8 +1756,6 @@ lustre/llite/autoMakefile
 lustre/lclient/Makefile
 lustre/lov/Makefile
 lustre/lov/autoMakefile
-lustre/lvfs/Makefile
-lustre/lvfs/autoMakefile
 lustre/mdc/Makefile
 lustre/mdc/autoMakefile
 lustre/lmv/Makefile
index c3eafd7..bb75665 100644 (file)
@@ -61,7 +61,6 @@ EXTRA_DIST = \
        lustre_export.h \
        lustre_fid.h \
        lustre_fld.h \
-       lustre_fsfilt.h \
        lustre_ha.h \
        lustre_handles.h \
        lustre_idmap.h \
index 08894b0..372ea82 100644 (file)
@@ -98,7 +98,6 @@
  * super-class definitions.
  */
 #include <lu_object.h>
-#include <lvfs.h>
 #ifdef __KERNEL__
 #        include <linux/mutex.h>
 #        include <linux/radix-tree.h>
index f30e85e..fb8b591 100644 (file)
@@ -1,5 +1,5 @@
 EXTRA_DIST = lprocfs_status.h lustre_debug.h lustre_lib.h \
        lustre_dlm.h lustre_handles.h lustre_net.h obd_class.h obd_support.h \
-       lustre_log.h lustre_compat.h lustre_fsfilt.h lustre_mds.h obd.h \
+       lustre_log.h lustre_compat.h lustre_mds.h obd.h \
        lvfs.h lustre_lite.h lustre_quota.h \
        lustre_user.h
diff --git a/lustre/include/darwin/lustre_fsfilt.h b/lustre/include/darwin/lustre_fsfilt.h
deleted file mode 100644 (file)
index 400e773..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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 (c) 2005, 2010, Oracle and/or its affiliates. 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/include/darwin/lustre_fsfilt.h
- *
- * Filesystem interface helper.
- */
-
-#ifndef _DARWIN_LUSTRE_FSFILT_H
-#define _DARWIN_LUSTRE_FSFILT_H
-
-#ifndef _LUSTRE_FSFILT_H
-#error Do not #include this file directly. #include <lustre_fsfilt.h> instead
-#endif
-
-#endif
index 890d4f9..5c1af1d 100644 (file)
@@ -44,6 +44,6 @@ endif
 
 EXTRA_DIST = lprocfs_status.h lustre_acl.h lustre_debug.h lustre_lib.h \
        lustre_dlm.h  lustre_handles.h lustre_net.h obd_class.h obd_support.h \
-       lustre_log.h lustre_compat25.h lustre_fsfilt.h \
+       lustre_log.h lustre_compat25.h \
        obd.h lvfs.h lvfs_linux.h lustre_lite.h lustre_quota.h \
        lustre_user.h lustre_patchless_compat.h lustre_intent.h lustre_common.h
diff --git a/lustre/include/linux/lustre_fsfilt.h b/lustre/include/linux/lustre_fsfilt.h
deleted file mode 100644 (file)
index 5b6797c..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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 (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2012, 2013, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * lustre/include/linux/lustre_fsfilt.h
- *
- * Filesystem interface helper.
- */
-
-#ifndef _LINUX_LUSTRE_FSFILT_H
-#define _LINUX_LUSTRE_FSFILT_H
-
-#ifndef _LUSTRE_FSFILT_H
-#error Do not #include this file directly. #include <lustre_fsfilt.h> instead
-#endif
-
-#ifdef __KERNEL__
-
-#include <obd.h>
-#include <obd_class.h>
-
-struct fsfilt_operations {
-       cfs_list_t fs_list;
-       struct module *fs_owner;
-       char   *fs_type;
-       int     (* fs_map_inode_pages)(struct inode *inode, struct page **page,
-                                      int pages, unsigned long *blocks,
-                                      int create, struct mutex *sem);
-};
-
-extern int fsfilt_register_ops(struct fsfilt_operations *fs_ops);
-extern void fsfilt_unregister_ops(struct fsfilt_operations *fs_ops);
-extern struct fsfilt_operations *fsfilt_get_ops(const char *type);
-extern void fsfilt_put_ops(struct fsfilt_operations *fs_ops);
-
-#define __fsfilt_check_slow(obd, start, msg)                              \
-do {                                                                      \
-       if (cfs_time_before(jiffies, start + 15 * HZ))                    \
-               break;                                                    \
-       else if (cfs_time_before(jiffies, start + 30 * HZ))               \
-               CDEBUG(D_VFSTRACE, "%s: slow %s %lus\n", obd->obd_name,   \
-                      msg, (jiffies-start) / HZ);                        \
-       else if (cfs_time_before(jiffies, start + DISK_TIMEOUT * HZ))     \
-               CWARN("%s: slow %s %lus\n", obd->obd_name, msg,           \
-                     (jiffies - start) / HZ);                            \
-       else                                                              \
-               CERROR("%s: slow %s %lus\n", obd->obd_name, msg,          \
-                      (jiffies - start) / HZ);                           \
-} while (0)
-
-#define fsfilt_check_slow(obd, start, msg)              \
-do {                                                    \
-        __fsfilt_check_slow(obd, start, msg);           \
-        start = jiffies;                                \
-} while (0)
-
-#endif /* __KERNEL__ */
-
-#endif
index cb0523e..154832b 100644 (file)
@@ -49,8 +49,6 @@
 #define l_filp_open filp_open
 
 struct lvfs_run_ctxt;
-struct l_file *l_dentry_open(struct lvfs_run_ctxt *, struct l_dentry *,
-                             int flags);
 
 struct l_linux_dirent {
         cfs_list_t      lld_list;
index 471f437..352b38e 100644 (file)
@@ -61,7 +61,6 @@
 #ifdef __KERNEL__
 # include <linux/types.h>
 # include <linux/blkdev.h>
-# include <lvfs.h>
 #else /* !__KERNEL__ */
 # define LTIME_S(time) (time)
 /* for obd_class.h */
diff --git a/lustre/include/lustre_fsfilt.h b/lustre/include/lustre_fsfilt.h
deleted file mode 100644 (file)
index 21cfa60..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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 (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2012, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * lustre/include/lustre_fsfilt.h
- *
- * Filesystem interface helper.
- */
-
-#ifndef _LUSTRE_FSFILT_H
-#define _LUSTRE_FSFILT_H
-
-#if defined(__linux__)
-#include <linux/lustre_fsfilt.h>
-#elif defined(__APPLE__)
-#include <darwin/lustre_fsfilt.h>
-#elif defined(__WINNT__)
-#include <winnt/lustre_fsfilt.h>
-#else
-#error Unsupported operating system.
-#endif
-
-#define LU221_BAD_TIME (0x80000000U + 24 * 3600)
-
-#endif
index 8a9b62f..d0af708 100644 (file)
@@ -67,7 +67,6 @@ struct lu_target;
 struct l_wait_info;
 #include <lustre_ha.h>
 #include <lustre_net.h>
-#include <lvfs.h>
 
 #ifdef HAVE_SERVER_SUPPORT
 void target_client_add_cb(struct obd_device *obd, __u64 transno, void *cb_data,
index 8fff863..7f16cfc 100644 (file)
@@ -58,9 +58,7 @@
 #include <lvfs_user_fs.h>
 #endif
 
-/* lvfs_common.c */
-struct dentry *lvfs_fid2dentry(struct lvfs_run_ctxt *, __u64, __u32, __u64 ,void *data);
-
+/* lvfs_linux.c */
 void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx,
                struct lvfs_ucred *cred);
 void pop_ctxt(struct lvfs_run_ctxt *saved, struct lvfs_run_ctxt *new_ctx,
index 1de0352..0a60555 100644 (file)
@@ -895,7 +895,6 @@ struct obd_device {
        spinlock_t              obd_dev_lock; /* protect OBD bitfield above */
        struct mutex            obd_dev_mutex;
        __u64                   obd_last_committed;
-       struct fsfilt_operations *obd_fsops;
        spinlock_t              obd_osfs_lock;
        struct obd_statfs       obd_osfs;       /* locked by obd_osfs_lock */
        __u64                   obd_osfs_age;
index 497b177..e0d75b1 100644 (file)
@@ -19,8 +19,7 @@ LUSTRE_LIBS = libllite.a \
               $(top_builddir)/lustre/mdc/libmdc.a \
               $(top_builddir)/lustre/mgc/libmgc.a \
               $(top_builddir)/lustre/ptlrpc/libptlrpc.a \
-              $(top_builddir)/lustre/obdclass/liblustreclass.a \
-              $(top_builddir)/lustre/lvfs/liblvfs.a
+             $(top_builddir)/lustre/obdclass/liblustreclass.a
 
 LND_LIBS =
 if BUILD_USOCKLND
index 0694d62..ce5445a 100755 (executable)
@@ -73,7 +73,6 @@ build_obj_list ../fld libfld.a
 build_obj_list ../mgc libmgc.a
 build_obj_list ../ptlrpc libptlrpc.a
 build_obj_list ../obdclass liblustreclass.a
-build_obj_list ../lvfs liblvfs.a
 
 # lnet components libs
 build_obj_list ../../lnet/utils libuptlctl.a
diff --git a/lustre/lvfs/.gitignore b/lustre/lvfs/.gitignore
deleted file mode 100644 (file)
index 7ace0ae..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/fsfilt-*.c
-/sources
-/fsfilt_ldiskfs.*
-/fsfilt-ldiskfs.*
diff --git a/lustre/lvfs/Makefile.in b/lustre/lvfs/Makefile.in
deleted file mode 100644 (file)
index a2322a3..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-MODULES := lvfs
-@LDISKFS_ENABLED_TRUE@MODULES += fsfilt_ldiskfs
-
-lvfs-objs := lvfs_linux.o fsfilt.o lvfs_lib.o
-
-@LDISKFS_ENABLED_TRUE@fsfilt_ldiskfs-objs := fsfilt-ldiskfs.o
-
-$(obj)/fsfilt-%.c: $(obj)/fsfilt_%.c
-       ln -s $< $@
-
-EXTRA_DIST = $(lvfs-objs:.o=.c) fsfilt_ext3.c
-
-# for <ext3/xattr.h> on 2.6
-EXTRA_PRE_CFLAGS := -I@LINUX@/fs -I@abs_top_builddir@ -I@abs_top_builddir@/ldiskfs
-
-@INCLUDE_RULES@
diff --git a/lustre/lvfs/autoMakefile.am b/lustre/lvfs/autoMakefile.am
deleted file mode 100644 (file)
index 61301e3..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-#
-# 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 (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
-# Use is subject to license terms.
-#
-# Copyright (c) 2012, Intel Corporation.
-#
-
-#
-# This file is part of Lustre, http://www.lustre.org/
-# Lustre is a trademark of Sun Microsystems, Inc.
-#
-
-if LIBLUSTRE
-noinst_LIBRARIES = liblvfs.a
-liblvfs_a_SOURCES = lvfs_lib.c
-liblvfs_a_CFLAGS = $(LLCFLAGS)
-liblvfs_a_CPPFLAGS = $(LLCPPFLAGS)
-endif
-
-if MODULES
-
-if LINUX
-
-modulefs_DATA := lvfs$(KMODEXT)
-
-if SERVER
-if LDISKFS_ENABLED
-modulefs_DATA += fsfilt_ldiskfs$(KMODEXT)
-
-sources: fsfilt_ldiskfs.c
-       touch sources
-else #LDISKFS_ENABLED
-sources:
-endif #LDISKFS_ENABLED
-else #SERVER
-sources:
-
-endif #SERVER
-
-ldiskfs_sed_flags = \
-       -e "s/EXT3/LDISKFS/g" -e "s/ext3/ldiskfs/g" \
-       -e "s/EXT4/LDISKFS/g" -e "s/ext4/ldiskfs/g"
-
-fsfilt_ldiskfs.c: fsfilt_ext3.c
-       sed $(strip $(ldiskfs_sed_flags)) $< > $@
-
-endif # LINUX
-
-else # MODULES
-
-sources:
-
-endif # MODULES
-
-install-data-hook: $(install_data_hook)
-
-MOSTLYCLEANFILES := @MOSTLYCLEANFILES@
-CLEANFILES = fsfilt-*.c fsfilt_ldiskfs*.c fsfilt_extN.c sources
diff --git a/lustre/lvfs/fsfilt.c b/lustre/lvfs/fsfilt.c
deleted file mode 100644 (file)
index d5fe34b..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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 (c) 2002, 2010, Oracle and/or its affiliates. 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.
- */
-
-#define DEBUG_SUBSYSTEM S_FILTER
-
-#include <linux/fs.h>
-#include <linux/jbd.h>
-#include <linux/module.h>
-#include <linux/kmod.h>
-#include <linux/slab.h>
-#include <libcfs/libcfs.h>
-#include <lustre_fsfilt.h>
-
-CFS_LIST_HEAD(fsfilt_types);
-
-static struct fsfilt_operations *fsfilt_search_type(const char *type)
-{
-        struct fsfilt_operations *found;
-        cfs_list_t *p;
-
-        cfs_list_for_each(p, &fsfilt_types) {
-                found = cfs_list_entry(p, struct fsfilt_operations, fs_list);
-                if (!strcmp(found->fs_type, type)) {
-                        return found;
-                }
-        }
-        return NULL;
-}
-
-int fsfilt_register_ops(struct fsfilt_operations *fs_ops)
-{
-        struct fsfilt_operations *found;
-
-        /* lock fsfilt_types list */
-        if ((found = fsfilt_search_type(fs_ops->fs_type))) {
-                if (found != fs_ops) {
-                        CERROR("different operations for type %s\n",
-                               fs_ops->fs_type);
-                        /* unlock fsfilt_types list */
-                        RETURN(-EEXIST);
-                }
-       } else {
-               try_module_get(THIS_MODULE);
-               cfs_list_add(&fs_ops->fs_list, &fsfilt_types);
-       }
-
-        /* unlock fsfilt_types list */
-        return 0;
-}
-EXPORT_SYMBOL(fsfilt_register_ops);
-
-void fsfilt_unregister_ops(struct fsfilt_operations *fs_ops)
-{
-        cfs_list_t *p;
-
-        /* lock fsfilt_types list */
-        cfs_list_for_each(p, &fsfilt_types) {
-                struct fsfilt_operations *found;
-
-               found = cfs_list_entry(p, typeof(*found), fs_list);
-               if (found == fs_ops) {
-                       cfs_list_del(p);
-                       module_put(THIS_MODULE);
-                       break;
-               }
-        }
-        /* unlock fsfilt_types list */
-}
-EXPORT_SYMBOL(fsfilt_unregister_ops);
-
-struct fsfilt_operations *fsfilt_get_ops(const char *type)
-{
-       struct fsfilt_operations *fs_ops;
-
-       /* lock fsfilt_types list */
-       if (!(fs_ops = fsfilt_search_type(type))) {
-               char name[32];
-               int rc;
-
-               snprintf(name, sizeof(name) - 1, "fsfilt_%s", type);
-               name[sizeof(name) - 1] = '\0';
-
-               if (!(rc = request_module("%s", name))) {
-                       fs_ops = fsfilt_search_type(type);
-                       CDEBUG(D_INFO, "Loaded module '%s'\n", name);
-                       if (!fs_ops)
-                               rc = -ENOENT;
-               }
-
-               if (rc) {
-                       CERROR("Can't find %s interface\n", name);
-                       RETURN(ERR_PTR(rc < 0 ? rc : -rc));
-                       /* unlock fsfilt_types list */
-               }
-       }
-       try_module_get(fs_ops->fs_owner);
-       /* unlock fsfilt_types list */
-
-       return fs_ops;
-}
-EXPORT_SYMBOL(fsfilt_get_ops);
-
-void fsfilt_put_ops(struct fsfilt_operations *fs_ops)
-{
-       module_put(fs_ops->fs_owner);
-}
-EXPORT_SYMBOL(fsfilt_put_ops);
diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c
deleted file mode 100644 (file)
index ab02c2d..0000000
+++ /dev/null
@@ -1,467 +0,0 @@
-/*
- * 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 (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2011, 2013, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * lustre/lvfs/fsfilt_ext3.c
- *
- * Author: Andreas Dilger <adilger@clusterfs.com>
- */
-
-#define DEBUG_SUBSYSTEM S_FILTER
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/slab.h>
-#include <linux/pagemap.h>
-#include <ext4/ext4.h>
-#include <ext4/ext4_jbd2.h>
-#include <linux/version.h>
-#include <linux/bitops.h>
-#include <linux/quota.h>
-
-#include <libcfs/libcfs.h>
-#include <lustre_fsfilt.h>
-#include <obd.h>
-#include <linux/lustre_compat25.h>
-#include <linux/lprocfs_status.h>
-
-#include <ext4/ext4_extents.h>
-
-#ifdef HAVE_EXT_PBLOCK /* Name changed to ext4_ext_pblock for kernel 2.6.35 */
-#define ext3_ext_pblock(ex) ext_pblock((ex))
-#endif
-
-/* for kernels 2.6.18 and later */
-#define fsfilt_ext3_ext_insert_extent(handle, inode, path, newext, flag) \
-               ext3_ext_insert_extent(handle, inode, path, newext, flag)
-
-#define ext3_mb_discard_inode_preallocations(inode) \
-                 ext3_discard_preallocations(inode)
-
-#ifndef EXT3_EXTENTS_FL
-#define EXT3_EXTENTS_FL                 0x00080000 /* Inode uses extents */
-#endif
-
-#ifndef EXT_ASSERT
-#define EXT_ASSERT(cond)  BUG_ON(!(cond))
-#endif
-
-#define EXT_GENERATION(inode)           (EXT4_I(inode)->i_ext_generation)
-#define ext3_ext_base                   inode
-#define ext3_ext_base2inode(inode)      (inode)
-#define EXT_DEPTH(inode)                ext_depth(inode)
-#define fsfilt_ext3_ext_walk_space(inode, block, num, cb, cbdata) \
-                        ext3_ext_walk_space(inode, block, num, cb, cbdata);
-
-struct bpointers {
-        unsigned long *blocks;
-        unsigned long start;
-        int num;
-        int init_num;
-        int create;
-};
-
-static long ext3_ext_find_goal(struct inode *inode, struct ext3_ext_path *path,
-                               unsigned long block, int *aflags)
-{
-        struct ext3_inode_info *ei = EXT3_I(inode);
-        unsigned long bg_start;
-        unsigned long colour;
-        int depth;
-
-        if (path) {
-                struct ext3_extent *ex;
-                depth = path->p_depth;
-
-                /* try to predict block placement */
-                if ((ex = path[depth].p_ext))
-                       return ext4_ext_pblock(ex) + (block - le32_to_cpu(ex->ee_block));
-
-                /* it looks index is empty
-                 * try to find starting from index itself */
-                if (path[depth].p_bh)
-                        return path[depth].p_bh->b_blocknr;
-        }
-
-        /* OK. use inode's group */
-        bg_start = (ei->i_block_group * EXT3_BLOCKS_PER_GROUP(inode->i_sb)) +
-                le32_to_cpu(EXT3_SB(inode->i_sb)->s_es->s_first_data_block);
-        colour = (current->pid % 16) *
-                (EXT3_BLOCKS_PER_GROUP(inode->i_sb) / 16);
-        return bg_start + colour + block;
-}
-
-#define ll_unmap_underlying_metadata(sb, blocknr) \
-        unmap_underlying_metadata((sb)->s_bdev, blocknr)
-
-#ifndef EXT3_MB_HINT_GROUP_ALLOC
-static unsigned long new_blocks(handle_t *handle, struct ext3_ext_base *base,
-                                struct ext3_ext_path *path, unsigned long block,
-                                unsigned long *count, int *err)
-{
-        unsigned long pblock, goal;
-        int aflags = 0;
-        struct inode *inode = ext3_ext_base2inode(base);
-
-        goal = ext3_ext_find_goal(inode, path, block, &aflags);
-        aflags |= 2; /* block have been already reserved */
-        pblock = ext3_mb_new_blocks(handle, inode, goal, count, aflags, err);
-        return pblock;
-
-}
-#else
-static unsigned long new_blocks(handle_t *handle, struct ext3_ext_base *base,
-                                struct ext3_ext_path *path, unsigned long block,
-                                unsigned long *count, int *err)
-{
-        struct inode *inode = ext3_ext_base2inode(base);
-        struct ext3_allocation_request ar;
-        unsigned long pblock;
-        int aflags;
-
-        /* find neighbour allocated blocks */
-        ar.lleft = block;
-        *err = ext3_ext_search_left(base, path, &ar.lleft, &ar.pleft);
-        if (*err)
-                return 0;
-        ar.lright = block;
-        *err = ext3_ext_search_right(base, path, &ar.lright, &ar.pright);
-        if (*err)
-                return 0;
-
-        /* allocate new block */
-        ar.goal = ext3_ext_find_goal(inode, path, block, &aflags);
-        ar.inode = inode;
-        ar.logical = block;
-        ar.len = *count;
-        ar.flags = EXT3_MB_HINT_DATA;
-        pblock = ext3_mb_new_blocks(handle, &ar, err);
-        *count = ar.len;
-        return pblock;
-}
-#endif
-
-static int ext3_ext_new_extent_cb(struct ext3_ext_base *base,
-                                  struct ext3_ext_path *path,
-                                  struct ext3_ext_cache *cex,
-#ifdef HAVE_EXT_PREPARE_CB_EXTENT
-                                   struct ext3_extent *ex,
-#endif
-                                  void *cbdata)
-{
-        struct bpointers *bp = cbdata;
-        struct inode *inode = ext3_ext_base2inode(base);
-        struct ext3_extent nex;
-        unsigned long pblock;
-        unsigned long tgen;
-        int err, i;
-        unsigned long count;
-        handle_t *handle;
-
-#ifdef EXT3_EXT_CACHE_EXTENT
-        if (cex->ec_type == EXT3_EXT_CACHE_EXTENT)
-#else
-        if ((cex->ec_len != 0) && (cex->ec_start != 0))
-#endif
-                                                  {
-                err = EXT_CONTINUE;
-                goto map;
-        }
-
-        if (bp->create == 0) {
-                i = 0;
-                if (cex->ec_block < bp->start)
-                        i = bp->start - cex->ec_block;
-                if (i >= cex->ec_len)
-                        CERROR("nothing to do?! i = %d, e_num = %u\n",
-                                        i, cex->ec_len);
-                for (; i < cex->ec_len && bp->num; i++) {
-                        *(bp->blocks) = 0;
-                        bp->blocks++;
-                        bp->num--;
-                        bp->start++;
-                }
-
-                return EXT_CONTINUE;
-        }
-
-       tgen = EXT_GENERATION(base);
-       count = ext3_ext_calc_credits_for_insert(base, path);
-
-       handle = ext3_journal_start(inode, count+EXT3_ALLOC_NEEDED+1);
-       if (IS_ERR(handle)) {
-               return PTR_ERR(handle);
-       }
-
-        if (tgen != EXT_GENERATION(base)) {
-                /* the tree has changed. so path can be invalid at moment */
-                ext3_journal_stop(handle);
-                return EXT_REPEAT;
-        }
-
-        /* In 2.6.32 kernel, ext4_ext_walk_space()'s callback func is not
-         * protected by i_data_sem as whole. so we patch it to store
-        * generation to path and now verify the tree hasn't changed */
-        down_write((&EXT4_I(inode)->i_data_sem));
-
-        /* validate extent, make sure the extent tree does not changed */
-       if (EXT_GENERATION(base) != path[0].p_generation) {
-                /* cex is invalid, try again */
-                up_write(&EXT4_I(inode)->i_data_sem);
-                ext3_journal_stop(handle);
-                return EXT_REPEAT;
-        }
-
-        count = cex->ec_len;
-        pblock = new_blocks(handle, base, path, cex->ec_block, &count, &err);
-        if (!pblock)
-                goto out;
-        EXT_ASSERT(count <= cex->ec_len);
-
-        /* insert new extent */
-        nex.ee_block = cpu_to_le32(cex->ec_block);
-        ext3_ext_store_pblock(&nex, pblock);
-        nex.ee_len = cpu_to_le16(count);
-        err = fsfilt_ext3_ext_insert_extent(handle, base, path, &nex, 0);
-        if (err) {
-                /* free data blocks we just allocated */
-                /* not a good idea to call discard here directly,
-                 * but otherwise we'd need to call it every free() */
-#ifdef EXT3_MB_HINT_GROUP_ALLOC
-                ext3_mb_discard_inode_preallocations(inode);
-#endif
-#ifdef HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD /* Introduced in 2.6.32-rc7 */
-               ext3_free_blocks(handle, inode, NULL, ext4_ext_pblock(&nex),
-                                cpu_to_le16(nex.ee_len), 0);
-#else
-               ext3_free_blocks(handle, inode, ext4_ext_pblock(&nex),
-                                cpu_to_le16(nex.ee_len), 0);
-#endif
-                goto out;
-        }
-
-        /*
-         * Putting len of the actual extent we just inserted,
-         * we are asking ext3_ext_walk_space() to continue
-         * scaning after that block
-         */
-        cex->ec_len = le16_to_cpu(nex.ee_len);
-       cex->ec_start = ext4_ext_pblock(&nex);
-        BUG_ON(le16_to_cpu(nex.ee_len) == 0);
-        BUG_ON(le32_to_cpu(nex.ee_block) != cex->ec_block);
-
-out:
-        up_write((&EXT4_I(inode)->i_data_sem));
-        ext3_journal_stop(handle);
-map:
-        if (err >= 0) {
-                /* map blocks */
-                if (bp->num == 0) {
-                        CERROR("hmm. why do we find this extent?\n");
-                        CERROR("initial space: %lu:%u\n",
-                                bp->start, bp->init_num);
-#ifdef EXT3_EXT_CACHE_EXTENT
-                        CERROR("current extent: %u/%u/%llu %d\n",
-                                cex->ec_block, cex->ec_len,
-                                (unsigned long long)cex->ec_start,
-                                cex->ec_type);
-#else
-                        CERROR("current extent: %u/%u/%llu\n",
-                                cex->ec_block, cex->ec_len,
-                                (unsigned long long)cex->ec_start);
-#endif
-                }
-                i = 0;
-                if (cex->ec_block < bp->start)
-                        i = bp->start - cex->ec_block;
-                if (i >= cex->ec_len)
-                        CERROR("nothing to do?! i = %d, e_num = %u\n",
-                                        i, cex->ec_len);
-                for (; i < cex->ec_len && bp->num; i++) {
-                        *(bp->blocks) = cex->ec_start + i;
-#ifdef EXT3_EXT_CACHE_EXTENT
-                       if (cex->ec_type != EXT3_EXT_CACHE_EXTENT)
-#else
-                       if ((cex->ec_len == 0) || (cex->ec_start == 0))
-#endif
-                                                                       {
-                                /* unmap any possible underlying metadata from
-                                 * the block device mapping.  bug 6998. */
-                                ll_unmap_underlying_metadata(inode->i_sb,
-                                                             *(bp->blocks));
-                        }
-                        bp->blocks++;
-                        bp->num--;
-                        bp->start++;
-                }
-        }
-        return err;
-}
-
-int fsfilt_map_nblocks(struct inode *inode, unsigned long block,
-                      unsigned long num, unsigned long *blocks,
-                      int create)
-{
-        struct ext3_ext_base *base = inode;
-        struct bpointers bp;
-        int err;
-
-        CDEBUG(D_OTHER, "blocks %lu-%lu requested for inode %u\n",
-               block, block + num - 1, (unsigned) inode->i_ino);
-
-        bp.blocks = blocks;
-        bp.start = block;
-        bp.init_num = bp.num = num;
-        bp.create = create;
-
-       err = fsfilt_ext3_ext_walk_space(base, block, num,
-                                        ext3_ext_new_extent_cb, &bp);
-       ext3_ext_invalidate_cache(base);
-
-        return err;
-}
-
-int fsfilt_ext3_map_ext_inode_pages(struct inode *inode, struct page **page,
-                                   int pages, unsigned long *blocks,
-                                   int create)
-{
-       int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits;
-        int rc = 0, i = 0;
-        struct page *fp = NULL;
-        int clen = 0;
-
-        CDEBUG(D_OTHER, "inode %lu: map %d pages from %lu\n",
-                inode->i_ino, pages, (*page)->index);
-
-        /* pages are sorted already. so, we just have to find
-         * contig. space and process them properly */
-        while (i < pages) {
-                if (fp == NULL) {
-                        /* start new extent */
-                        fp = *page++;
-                        clen = 1;
-                        i++;
-                        continue;
-                } else if (fp->index + clen == (*page)->index) {
-                        /* continue the extent */
-                        page++;
-                        clen++;
-                        i++;
-                        continue;
-                }
-
-                /* process found extent */
-                rc = fsfilt_map_nblocks(inode, fp->index * blocks_per_page,
-                                       clen * blocks_per_page, blocks,
-                                       create);
-                if (rc)
-                        GOTO(cleanup, rc);
-
-                /* look for next extent */
-                fp = NULL;
-                blocks += blocks_per_page * clen;
-        }
-
-        if (fp)
-                rc = fsfilt_map_nblocks(inode, fp->index * blocks_per_page,
-                                       clen * blocks_per_page, blocks,
-                                       create);
-cleanup:
-        return rc;
-}
-
-int fsfilt_ext3_map_bm_inode_pages(struct inode *inode, struct page **page,
-                                  int pages, unsigned long *blocks,
-                                  int create)
-{
-       int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits;
-       unsigned long *b;
-       int rc = 0, i;
-
-       for (i = 0, b = blocks; i < pages; i++, page++) {
-               rc = ext3_map_inode_page(inode, *page, b, create);
-                if (rc) {
-                       CERROR("ino %lu, blk %lu create %d: rc %d\n",
-                              inode->i_ino, *b, create, rc);
-                        break;
-                }
-
-                b += blocks_per_page;
-        }
-        return rc;
-}
-
-int fsfilt_ext3_map_inode_pages(struct inode *inode, struct page **page,
-                               int pages, unsigned long *blocks,
-                               int create, struct mutex *optional_mutex)
-{
-        int rc;
-
-        if (EXT3_I(inode)->i_flags & EXT3_EXTENTS_FL) {
-               rc = fsfilt_ext3_map_ext_inode_pages(inode, page, pages,
-                                                    blocks, create);
-                return rc;
-        }
-        if (optional_mutex != NULL)
-               mutex_lock(optional_mutex);
-       rc = fsfilt_ext3_map_bm_inode_pages(inode, page, pages, blocks, create);
-        if (optional_mutex != NULL)
-               mutex_unlock(optional_mutex);
-
-        return rc;
-}
-
-static struct fsfilt_operations fsfilt_ext3_ops = {
-       .fs_type                = "ext3",
-       .fs_owner               = THIS_MODULE,
-       .fs_map_inode_pages     = fsfilt_ext3_map_inode_pages,
-};
-
-static int __init fsfilt_ext3_init(void)
-{
-       return fsfilt_register_ops(&fsfilt_ext3_ops);
-}
-
-static void __exit fsfilt_ext3_exit(void)
-{
-       fsfilt_unregister_ops(&fsfilt_ext3_ops);
-}
-
-module_init(fsfilt_ext3_init);
-module_exit(fsfilt_ext3_exit);
-
-MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
-MODULE_DESCRIPTION("Lustre ext3 Filesystem Helper v0.1");
-MODULE_LICENSE("GPL");
diff --git a/lustre/lvfs/lvfs_linux.c b/lustre/lvfs/lvfs_linux.c
deleted file mode 100644 (file)
index a5d92d1..0000000
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * 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 (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2011, 2013, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * lustre/lvfs/lvfs_linux.c
- *
- * Author: Andreas Dilger <adilger@clusterfs.com>
- */
-
-#define DEBUG_SUBSYSTEM S_FILTER
-
-#include <linux/version.h>
-#include <linux/fs.h>
-#include <asm/unistd.h>
-#include <linux/slab.h>
-#include <linux/pagemap.h>
-#include <linux/quotaops.h>
-#include <linux/version.h>
-#include <libcfs/libcfs.h>
-#include <obd.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/lustre_compat25.h>
-#include <lvfs.h>
-
-#include <obd.h>
-#include <lustre_lib.h>
-
-struct lprocfs_stats *obd_memory = NULL;
-EXPORT_SYMBOL(obd_memory);
-/* refine later and change to seqlock or simlar from libcfs */
-
-/* Debugging check only needed during development */
-#ifdef OBD_CTXT_DEBUG
-# define ASSERT_CTXT_MAGIC(magic) LASSERT((magic) == OBD_RUN_CTXT_MAGIC)
-# define ASSERT_NOT_KERNEL_CTXT(msg) LASSERTF(!segment_eq(get_fs(), get_ds()),\
-                                              msg)
-# define ASSERT_KERNEL_CTXT(msg) LASSERTF(segment_eq(get_fs(), get_ds()), msg)
-#else
-# define ASSERT_CTXT_MAGIC(magic) do {} while(0)
-# define ASSERT_NOT_KERNEL_CTXT(msg) do {} while(0)
-# define ASSERT_KERNEL_CTXT(msg) do {} while(0)
-#endif
-
-static void push_group_info(struct lvfs_run_ctxt *save,
-                            struct group_info *ginfo)
-{
-        if (!ginfo) {
-                save->ngroups = current_ngroups;
-                current_ngroups = 0;
-        } else {
-                struct cred *cred;
-                task_lock(current);
-                save->group_info = current_cred()->group_info;
-                if ((cred = prepare_creds())) {
-                        cred->group_info = ginfo;
-                        commit_creds(cred);
-                }
-                task_unlock(current);
-        }
-}
-
-static void pop_group_info(struct lvfs_run_ctxt *save,
-                           struct group_info *ginfo)
-{
-        if (!ginfo) {
-                current_ngroups = save->ngroups;
-        } else {
-                struct cred *cred;
-                task_lock(current);
-                if ((cred = prepare_creds())) {
-                        cred->group_info = save->group_info;
-                        commit_creds(cred);
-                }
-                task_unlock(current);
-        }
-}
-
-/* push / pop to root of obd store */
-void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx,
-               struct lvfs_ucred *uc)
-{
-       /* if there is underlaying dt_device then push_ctxt is not needed */
-       if (new_ctx->dt != NULL)
-               return;
-
-        //ASSERT_NOT_KERNEL_CTXT("already in kernel context!\n");
-        ASSERT_CTXT_MAGIC(new_ctx->magic);
-        OBD_SET_CTXT_MAGIC(save);
-
-        save->fs = get_fs();
-       LASSERT(d_refcount(current->fs->pwd.dentry));
-       LASSERT(d_refcount(new_ctx->pwd));
-       save->pwd = dget(current->fs->pwd.dentry);
-       save->pwdmnt = mntget(current->fs->pwd.mnt);
-       save->luc.luc_umask = current_umask();
-       save->ngroups = current_cred()->group_info->ngroups;
-
-        LASSERT(save->pwd);
-        LASSERT(save->pwdmnt);
-        LASSERT(new_ctx->pwd);
-        LASSERT(new_ctx->pwdmnt);
-
-        if (uc) {
-                struct cred *cred;
-                save->luc.luc_uid = current_uid();
-                save->luc.luc_gid = current_gid();
-                save->luc.luc_fsuid = current_fsuid();
-                save->luc.luc_fsgid = current_fsgid();
-                save->luc.luc_cap = current_cap();
-
-                if ((cred = prepare_creds())) {
-                        cred->uid = uc->luc_uid;
-                        cred->gid = uc->luc_gid;
-                        cred->fsuid = uc->luc_fsuid;
-                        cred->fsgid = uc->luc_fsgid;
-                        cred->cap_effective = uc->luc_cap;
-                        commit_creds(cred);
-                }
-
-                push_group_info(save,
-                                uc->luc_ginfo ?:
-                                uc->luc_identity ? uc->luc_identity->mi_ginfo :
-                                                   NULL);
-        }
-        current->fs->umask = 0; /* umask already applied on client */
-        set_fs(new_ctx->fs);
-        ll_set_fs_pwd(current->fs, new_ctx->pwdmnt, new_ctx->pwd);
-}
-EXPORT_SYMBOL(push_ctxt);
-
-void pop_ctxt(struct lvfs_run_ctxt *saved, struct lvfs_run_ctxt *new_ctx,
-              struct lvfs_ucred *uc)
-{
-       /* if there is underlaying dt_device then pop_ctxt is not needed */
-       if (new_ctx->dt != NULL)
-               return;
-
-        ASSERT_CTXT_MAGIC(saved->magic);
-        ASSERT_KERNEL_CTXT("popping non-kernel context!\n");
-
-       LASSERTF(current->fs->pwd.dentry == new_ctx->pwd, "%p != %p\n",
-                current->fs->pwd.dentry, new_ctx->pwd);
-       LASSERTF(current->fs->pwd.mnt == new_ctx->pwdmnt, "%p != %p\n",
-                current->fs->pwd.mnt, new_ctx->pwdmnt);
-
-        set_fs(saved->fs);
-        ll_set_fs_pwd(current->fs, saved->pwdmnt, saved->pwd);
-
-        dput(saved->pwd);
-        mntput(saved->pwdmnt);
-        current->fs->umask = saved->luc.luc_umask;
-        if (uc) {
-                struct cred *cred;
-                if ((cred = prepare_creds())) {
-                        cred->uid = saved->luc.luc_uid;
-                        cred->gid = saved->luc.luc_gid;
-                        cred->fsuid = saved->luc.luc_fsuid;
-                        cred->fsgid = saved->luc.luc_fsgid;
-                        cred->cap_effective = saved->luc.luc_cap;
-                        commit_creds(cred);
-                }
-
-                pop_group_info(saved,
-                               uc->luc_ginfo ?:
-                               uc->luc_identity ? uc->luc_identity->mi_ginfo :
-                                                  NULL);
-        }
-}
-EXPORT_SYMBOL(pop_ctxt);
-
-/* utility to rename a file */
-int lustre_rename(struct dentry *dir, struct vfsmount *mnt,
-                  char *oldname, char *newname)
-{
-        struct dentry *dchild_old, *dchild_new;
-        int err = 0;
-        ENTRY;
-
-        ASSERT_KERNEL_CTXT("kernel doing rename outside kernel context\n");
-        CDEBUG(D_INODE, "renaming file %.*s to %.*s\n",
-               (int)strlen(oldname), oldname, (int)strlen(newname), newname);
-
-        dchild_old = ll_lookup_one_len(oldname, dir, strlen(oldname));
-        if (IS_ERR(dchild_old))
-                RETURN(PTR_ERR(dchild_old));
-
-        if (!dchild_old->d_inode)
-                GOTO(put_old, err = -ENOENT);
-
-        dchild_new = ll_lookup_one_len(newname, dir, strlen(newname));
-        if (IS_ERR(dchild_new))
-                GOTO(put_old, err = PTR_ERR(dchild_new));
-
-       err = vfs_rename(dir->d_inode, dchild_old, dir->d_inode, dchild_new);
-
-        dput(dchild_new);
-put_old:
-        dput(dchild_old);
-        RETURN(err);
-}
-EXPORT_SYMBOL(lustre_rename);
-
-/* Note: dput(dchild) will *not* be called if there is an error */
-struct l_file *l_dentry_open(struct lvfs_run_ctxt *ctxt, struct l_dentry *de,
-                            int flags)
-{
-       struct path path = {
-               .dentry = de,
-               .mnt = ctxt->pwdmnt,
-       };
-       return ll_dentry_open(&path, flags, current_cred());
-}
-EXPORT_SYMBOL(l_dentry_open);
-
-#ifdef LPROCFS
-__s64 lprocfs_read_helper(struct lprocfs_counter *lc,
-                         struct lprocfs_counter_header *header,
-                         enum lprocfs_stats_flags flags,
-                         enum lprocfs_fields_flags field)
-{
-       __s64 ret = 0;
-
-       if (lc == NULL || header == NULL)
-               RETURN(0);
-
-       switch (field) {
-               case LPROCFS_FIELDS_FLAGS_CONFIG:
-                       ret = header->lc_config;
-                       break;
-               case LPROCFS_FIELDS_FLAGS_SUM:
-                       ret = lc->lc_sum;
-                       if ((flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
-                               ret += lc->lc_sum_irq;
-                       break;
-               case LPROCFS_FIELDS_FLAGS_MIN:
-                       ret = lc->lc_min;
-                       break;
-               case LPROCFS_FIELDS_FLAGS_MAX:
-                       ret = lc->lc_max;
-                       break;
-               case LPROCFS_FIELDS_FLAGS_AVG:
-                       ret = (lc->lc_max - lc->lc_min) / 2;
-                       break;
-               case LPROCFS_FIELDS_FLAGS_SUMSQUARE:
-                       ret = lc->lc_sumsquare;
-                       break;
-               case LPROCFS_FIELDS_FLAGS_COUNT:
-                       ret = lc->lc_count;
-                       break;
-               default:
-                       break;
-       };
-
-       RETURN(ret);
-}
-EXPORT_SYMBOL(lprocfs_read_helper);
-#endif /* LPROCFS */
-
-MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
-MODULE_DESCRIPTION("Lustre VFS Filesystem Helper v0.1");
-MODULE_LICENSE("GPL");
index 45ffbee..5cfbfac 100644 (file)
@@ -5,10 +5,10 @@ obdclass-linux-objs := $(addprefix linux/,$(obdclass-linux-objs))
 
 default: all
 
-obdclass-all-objs := llog.o llog_cat.o llog_obd.o llog_swab.o
+obdclass-all-objs := llog.o llog_cat.o llog_obd.o llog_swab.o llog_osd.o
 obdclass-all-objs += class_obd.o debug.o genops.o uuid.o llog_ioctl.o
-obdclass-all-objs += lprocfs_status.o lustre_handles.o lustre_peer.o
-obdclass-all-objs += llog_osd.o local_storage.o
+obdclass-all-objs += lprocfs_status.o lprocfs_counters.o
+obdclass-all-objs += lustre_handles.o lustre_peer.o local_storage.o
 obdclass-all-objs += statfs_pack.o obdo.o obd_config.o obd_mount.o mea.o
 obdclass-all-objs += lu_object.o dt_object.o capa.o
 obdclass-all-objs += cl_object.o cl_page.o cl_lock.o cl_io.o lu_ref.o
index b1988b6..d131c59 100644 (file)
@@ -9,7 +9,7 @@ noinst_LIBRARIES = liblustreclass.a
 liblustreclass_a_SOURCES = class_obd.c debug.c genops.c statfs_pack.c mea.c uuid.c
 liblustreclass_a_SOURCES += lustre_handles.c lustre_peer.c lprocfs_status.c
 liblustreclass_a_SOURCES += obdo.c obd_config.c llog.c llog_obd.c llog_cat.c
-liblustreclass_a_SOURCES += llog_swab.c capa.c
+liblustreclass_a_SOURCES += llog_swab.c capa.c lprocfs_counters.c
 liblustreclass_a_SOURCES += lu_object.c cl_object.c lu_ref.c
 liblustreclass_a_SOURCES += cl_page.c cl_lock.c cl_io.c
 liblustreclass_a_SOURCES += #llog_ioctl.c rbtree.c
@@ -35,7 +35,8 @@ obdclass_SOURCES =                                            \
        lustre_handles.c lustre_peer.c obd_config.c             \
        obdo.c debug.c llog_ioctl.c uuid.c                      \
        llog_swab.c llog_obd.c llog.c llog_cat.c                \
-       mea.c lu_object.c dt_object.c lu_ref.c
+       mea.c lu_object.c dt_object.c lu_ref.c                  \
+       lprocfs_counters.c
 
 obdclass_CFLAGS := $(EXTRA_KCFLAGS)
 obdclass_LDFLAGS := $(EXTRA_KLDFLAGS)
index 8d2c1ac..8df4ad9 100644 (file)
@@ -112,6 +112,11 @@ EXPORT_SYMBOL(obd_dirty_transit_pages);
 char obd_jobid_var[JOBSTATS_JOBID_VAR_MAX_LEN + 1] = JOBSTATS_DISABLE;
 EXPORT_SYMBOL(obd_jobid_var);
 
+#ifdef LPROCFS
+struct lprocfs_stats *obd_memory = NULL;
+EXPORT_SYMBOL(obd_memory);
+#endif
+
 /* Get jobid of current process by reading the environment variable
  * stored in between the "env_start" & "env_end" of task struct.
  *
similarity index 73%
rename from lustre/lvfs/lvfs_lib.c
rename to lustre/obdclass/lprocfs_counters.c
index 40a01ab..51ce4ae 100644 (file)
  *
  * 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.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
  * This file is part of Lustre, http://www.lustre.org/
  * Lustre is a trademark of Sun Microsystems, Inc.
  *
- * lustre/lvfs/lvfs_lib.c
+ * lustre/obdclass/lprocfs_counters.c
  *
- * Lustre filesystem abstraction routines
+ * Lustre lprocfs counter routines
  *
- * Author: Andreas Dilger <adilger@clusterfs.com>
+ * Author: Andreas Dilger <andreas.dilger@intel.com>
  */
 #ifdef __KERNEL__
 #include <linux/module.h>
@@ -141,43 +138,4 @@ void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx, long amount)
        lprocfs_stats_unlock(stats, LPROCFS_GET_SMP_ID, &flags);
 }
 EXPORT_SYMBOL(lprocfs_counter_sub);
-
-int lprocfs_stats_alloc_one(struct lprocfs_stats *stats, unsigned int cpuid)
-{
-       struct lprocfs_counter  *cntr;
-       unsigned int            percpusize;
-       int                     rc = -ENOMEM;
-       unsigned long           flags = 0;
-       int                     i;
-
-       LASSERT(stats->ls_percpu[cpuid] == NULL);
-       LASSERT((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0);
-
-       percpusize = lprocfs_stats_counter_size(stats);
-       LIBCFS_ALLOC_ATOMIC(stats->ls_percpu[cpuid], percpusize);
-       if (stats->ls_percpu[cpuid] != NULL) {
-               rc = 0;
-               if (unlikely(stats->ls_biggest_alloc_num <= cpuid)) {
-                       if (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE)
-                               spin_lock_irqsave(&stats->ls_lock, flags);
-                       else
-                               spin_lock(&stats->ls_lock);
-                       if (stats->ls_biggest_alloc_num <= cpuid)
-                               stats->ls_biggest_alloc_num = cpuid + 1;
-                       if (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) {
-                               spin_unlock_irqrestore(&stats->ls_lock, flags);
-                       } else {
-                               spin_unlock(&stats->ls_lock);
-                       }
-               }
-               /* initialize the ls_percpu[cpuid] non-zero counter */
-               for (i = 0; i < stats->ls_num; ++i) {
-                       cntr = lprocfs_stats_counter_get(stats, cpuid, i);
-                       cntr->lc_min = LC_MIN_INIT;
-               }
-       }
-
-       return rc;
-}
-EXPORT_SYMBOL(lprocfs_stats_alloc_one);
 #endif  /* LPROCFS */
index 885287c..6356f2a 100644 (file)
@@ -1266,6 +1266,44 @@ void lprocfs_free_per_client_stats(struct obd_device *obd)
 }
 EXPORT_SYMBOL(lprocfs_free_per_client_stats);
 
+int lprocfs_stats_alloc_one(struct lprocfs_stats *stats, unsigned int cpuid)
+{
+       struct lprocfs_counter  *cntr;
+       unsigned int            percpusize;
+       int                     rc = -ENOMEM;
+       unsigned long           flags = 0;
+       int                     i;
+
+       LASSERT(stats->ls_percpu[cpuid] == NULL);
+       LASSERT((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0);
+
+       percpusize = lprocfs_stats_counter_size(stats);
+       LIBCFS_ALLOC_ATOMIC(stats->ls_percpu[cpuid], percpusize);
+       if (stats->ls_percpu[cpuid] != NULL) {
+               rc = 0;
+               if (unlikely(stats->ls_biggest_alloc_num <= cpuid)) {
+                       if (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE)
+                               spin_lock_irqsave(&stats->ls_lock, flags);
+                       else
+                               spin_lock(&stats->ls_lock);
+                       if (stats->ls_biggest_alloc_num <= cpuid)
+                               stats->ls_biggest_alloc_num = cpuid + 1;
+                       if (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) {
+                               spin_unlock_irqrestore(&stats->ls_lock, flags);
+                       } else {
+                               spin_unlock(&stats->ls_lock);
+                       }
+               }
+               /* initialize the ls_percpu[cpuid] non-zero counter */
+               for (i = 0; i < stats->ls_num; ++i) {
+                       cntr = lprocfs_stats_counter_get(stats, cpuid, i);
+                       cntr->lc_min = LC_MIN_INIT;
+               }
+       }
+       return rc;
+}
+EXPORT_SYMBOL(lprocfs_stats_alloc_one);
+
 struct lprocfs_stats *lprocfs_alloc_stats(unsigned int num,
                                           enum lprocfs_stats_flags flags)
 {
@@ -2073,6 +2111,47 @@ int lprocfs_exp_cleanup(struct obd_export *exp)
 }
 EXPORT_SYMBOL(lprocfs_exp_cleanup);
 
+__s64 lprocfs_read_helper(struct lprocfs_counter *lc,
+                         struct lprocfs_counter_header *header,
+                         enum lprocfs_stats_flags flags,
+                         enum lprocfs_fields_flags field)
+{
+       __s64 ret = 0;
+
+       if (lc == NULL || header == NULL)
+               RETURN(0);
+
+       switch (field) {
+               case LPROCFS_FIELDS_FLAGS_CONFIG:
+                       ret = header->lc_config;
+                       break;
+               case LPROCFS_FIELDS_FLAGS_SUM:
+                       ret = lc->lc_sum;
+                       if ((flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
+                               ret += lc->lc_sum_irq;
+                       break;
+               case LPROCFS_FIELDS_FLAGS_MIN:
+                       ret = lc->lc_min;
+                       break;
+               case LPROCFS_FIELDS_FLAGS_MAX:
+                       ret = lc->lc_max;
+                       break;
+               case LPROCFS_FIELDS_FLAGS_AVG:
+                       ret = (lc->lc_max - lc->lc_min) / 2;
+                       break;
+               case LPROCFS_FIELDS_FLAGS_SUMSQUARE:
+                       ret = lc->lc_sumsquare;
+                       break;
+               case LPROCFS_FIELDS_FLAGS_COUNT:
+                       ret = lc->lc_count;
+                       break;
+               default:
+                       break;
+       };
+       RETURN(ret);
+}
+EXPORT_SYMBOL(lprocfs_read_helper);
+
 int lprocfs_write_helper(const char *buffer, unsigned long count,
                          int *val)
 {
index 25aae80..3346255 100644 (file)
@@ -46,7 +46,6 @@
 #define PRINT_CMD CDEBUG
 
 #include <obd.h>
-#include <lvfs.h>
 #include <obd_class.h>
 #include <lustre/lustre_user.h>
 #include <linux/version.h>
index c3352d7..6dbc07a 100644 (file)
@@ -47,7 +47,6 @@
 #define PRINT_MASK (D_SUPER | D_CONFIG)
 
 #include <obd.h>
-#include <lvfs.h>
 #include <obd_class.h>
 #include <lustre/lustre_user.h>
 #include <linux/version.h>
@@ -1355,7 +1354,7 @@ static int lsi_prepare(struct lustre_sb_info *lsi)
                strcpy(lsi->lsi_osd_type, LUSTRE_OSD_LDISKFS_NAME);
        }
 
-       /* XXX: a temp. solution for components using fsfilt
+       /* XXX: a temp. solution for components using ldiskfs
         *      to be removed in one of the subsequent patches */
        if (!strcmp(lsi->lsi_lmd->lmd_osd_type, "osd-ldiskfs"))
                strcpy(lsi->lsi_fstype, "ldiskfs");
index 9c48eb0..e8d4cb2 100644 (file)
@@ -441,7 +441,7 @@ int ofd_clients_data_init(const struct lu_env *env, struct ofd_device *ofd,
                __u64                    last_rcvd;
 
                /* Don't assume off is incremented properly by
-                * fsfilt_read_record(), in case sizeof(*lcd)
+                * read_record(), in case sizeof(*lcd)
                 * isn't the same as fsd->lsd_client_size.  */
                off = lsd->lsd_client_start + cl_idx * lsd->lsd_client_size;
                rc = tgt_client_data_read(env, &ofd->ofd_lut, lcd, &off, cl_idx);
index c6ac60c..2fceb69 100644 (file)
@@ -182,8 +182,6 @@ static int osd_mdt_init(const struct lu_env *env, struct osd_device *dev)
 
        omm = dev->od_mdt_map;
 
-       LASSERT(dev->od_fsops);
-
        parent = osd_sb(dev)->s_root;
        osd_push_ctxt(dev, &new, &save);
 
@@ -393,7 +391,6 @@ static int osd_ost_init(const struct lu_env *env, struct osd_device *dev)
        rwlock_init(&dev->od_ost_map->om_seq_list_lock);
        sema_init(&dev->od_ost_map->om_dir_init_sem, 1);
 
-        LASSERT(dev->od_fsops);
         osd_push_ctxt(dev, &new, &save);
 
        d = ll_lookup_one_len("O", rootd, strlen("O"));
index cfa872f..46d6c77 100644 (file)
@@ -5395,11 +5395,6 @@ static void osd_umount(const struct lu_env *env, struct osd_device *o)
 {
        ENTRY;
 
-       if (o->od_fsops) {
-               fsfilt_put_ops(o->od_fsops);
-               o->od_fsops = NULL;
-       }
-
        if (o->od_mnt != NULL) {
                shrink_dcache_sb(osd_sb(o));
                osd_sync(env, &o->od_dt_dev);
@@ -5435,13 +5430,6 @@ static int osd_mount(const struct lu_env *env,
                RETURN(-E2BIG);
        strcpy(o->od_mntdev, dev);
 
-       o->od_fsops = fsfilt_get_ops(mt_str(LDD_MT_LDISKFS));
-       if (IS_ERR(o->od_fsops)) {
-               CERROR("%s: Can't find fsfilt_ldiskfs\n", name);
-               o->od_fsops = NULL;
-               RETURN(-ENOTSUPP);
-       }
-
        OBD_PAGE_ALLOC(__page, GFP_IOFS);
        if (__page == NULL)
                GOTO(out, rc = -ENOMEM);
@@ -5516,8 +5504,6 @@ out_mnt:
 out:
        if (__page)
                OBD_PAGE_FREE(__page);
-       if (rc)
-               fsfilt_put_ops(o->od_fsops);
 
        return rc;
 }
index cb390c4..c5440ae 100644 (file)
@@ -55,9 +55,6 @@
 #include <ldiskfs/ldiskfs.h>
 #include <ldiskfs/ldiskfs_jbd2.h>
 
-/* fsfilt_{get|put}_ops */
-#include <lustre_fsfilt.h>
-
 /* LUSTRE_OSD_NAME */
 #include <obd.h>
 /* class_register_type(), class_unregister_type(), class_get_type() */
@@ -259,7 +256,6 @@ struct osd_device {
         struct obd_statfs         od_statfs;
        spinlock_t                od_osfs_lock;
 
-       struct fsfilt_operations *od_fsops;
        int                       od_connects;
        struct lu_site            od_site;
 
index a217bb3..cb5a30f 100644 (file)
@@ -517,6 +517,344 @@ static int osd_bufs_put(const struct lu_env *env, struct dt_object *dt,
         RETURN(0);
 }
 
+#ifdef HAVE_EXT_PBLOCK /* Name changed to ext4_ext_pblock for kernel 2.6.35 */
+#define ldiskfs_ext_pblock(ex) ext_pblock((ex))
+#endif
+
+struct bpointers {
+       unsigned long *blocks;
+       unsigned long start;
+       int num;
+       int init_num;
+       int create;
+};
+
+static long ldiskfs_ext_find_goal(struct inode *inode,
+                                 struct ldiskfs_ext_path *path,
+                                 unsigned long block, int *aflags)
+{
+       struct ldiskfs_inode_info *ei = LDISKFS_I(inode);
+       unsigned long bg_start;
+       unsigned long colour;
+       int depth;
+
+       if (path) {
+               struct ldiskfs_extent *ex;
+               depth = path->p_depth;
+
+               /* try to predict block placement */
+               if ((ex = path[depth].p_ext))
+                       return ldiskfs_ext_pblock(ex) +
+                               (block - le32_to_cpu(ex->ee_block));
+
+               /* it looks index is empty
+                * try to find starting from index itself */
+               if (path[depth].p_bh)
+                       return path[depth].p_bh->b_blocknr;
+       }
+
+       /* OK. use inode's group */
+       bg_start = (ei->i_block_group * LDISKFS_BLOCKS_PER_GROUP(inode->i_sb)) +
+               le32_to_cpu(LDISKFS_SB(inode->i_sb)->s_es->s_first_data_block);
+       colour = (current->pid % 16) *
+               (LDISKFS_BLOCKS_PER_GROUP(inode->i_sb) / 16);
+       return bg_start + colour + block;
+}
+
+static unsigned long new_blocks(handle_t *handle, struct inode *inode,
+                               struct ldiskfs_ext_path *path,
+                               unsigned long block, unsigned long *count,
+                               int *err)
+{
+       struct ldiskfs_allocation_request ar;
+       unsigned long pblock;
+       int aflags;
+
+       /* find neighbour allocated blocks */
+       ar.lleft = block;
+       *err = ldiskfs_ext_search_left(inode, path, &ar.lleft, &ar.pleft);
+       if (*err)
+               return 0;
+       ar.lright = block;
+       *err = ldiskfs_ext_search_right(inode, path, &ar.lright, &ar.pright);
+       if (*err)
+               return 0;
+
+       /* allocate new block */
+       ar.goal = ldiskfs_ext_find_goal(inode, path, block, &aflags);
+       ar.inode = inode;
+       ar.logical = block;
+       ar.len = *count;
+       ar.flags = LDISKFS_MB_HINT_DATA;
+       pblock = ldiskfs_mb_new_blocks(handle, &ar, err);
+       *count = ar.len;
+       return pblock;
+}
+
+static int ldiskfs_ext_new_extent_cb(struct inode *inode,
+                                    struct ldiskfs_ext_path *path,
+                                    struct ldiskfs_ext_cache *cex,
+#ifdef HAVE_EXT_PREPARE_CB_EXTENT
+                                    struct ldiskfs_extent *ex,
+#endif
+                                    void *cbdata)
+{
+       struct bpointers *bp = cbdata;
+       struct ldiskfs_extent nex;
+       unsigned long pblock;
+       unsigned long tgen;
+       int err, i;
+       unsigned long count;
+       handle_t *handle;
+
+#ifdef LDISKFS_EXT_CACHE_EXTENT /* until kernel 2.6.37 */
+       if (cex->ec_type == LDISKFS_EXT_CACHE_EXTENT) {
+#else
+       if ((cex->ec_len != 0) && (cex->ec_start != 0)) {
+#endif
+               err = EXT_CONTINUE;
+               goto map;
+       }
+
+       if (bp->create == 0) {
+               i = 0;
+               if (cex->ec_block < bp->start)
+                       i = bp->start - cex->ec_block;
+               if (i >= cex->ec_len)
+                       CERROR("nothing to do?! i = %d, e_num = %u\n",
+                                       i, cex->ec_len);
+               for (; i < cex->ec_len && bp->num; i++) {
+                       *(bp->blocks) = 0;
+                       bp->blocks++;
+                       bp->num--;
+                       bp->start++;
+               }
+
+               return EXT_CONTINUE;
+       }
+
+       tgen = LDISKFS_I(inode)->i_ext_generation;
+       count = ldiskfs_ext_calc_credits_for_insert(inode, path);
+
+       handle = ldiskfs_journal_start(inode, count + LDISKFS_ALLOC_NEEDED + 1);
+       if (IS_ERR(handle)) {
+               return PTR_ERR(handle);
+       }
+
+       if (tgen != LDISKFS_I(inode)->i_ext_generation) {
+               /* the tree has changed. so path can be invalid at moment */
+               ldiskfs_journal_stop(handle);
+               return EXT_REPEAT;
+       }
+
+       /* In 2.6.32 kernel, ldiskfs_ext_walk_space()'s callback func is not
+        * protected by i_data_sem as whole. so we patch it to store
+        * generation to path and now verify the tree hasn't changed */
+       down_write((&LDISKFS_I(inode)->i_data_sem));
+
+       /* validate extent, make sure the extent tree does not changed */
+       if (LDISKFS_I(inode)->i_ext_generation != path[0].p_generation) {
+               /* cex is invalid, try again */
+               up_write(&LDISKFS_I(inode)->i_data_sem);
+               ldiskfs_journal_stop(handle);
+               return EXT_REPEAT;
+       }
+
+       count = cex->ec_len;
+       pblock = new_blocks(handle, inode, path, cex->ec_block, &count, &err);
+       if (!pblock)
+               goto out;
+       BUG_ON(count > cex->ec_len);
+
+       /* insert new extent */
+       nex.ee_block = cpu_to_le32(cex->ec_block);
+       ldiskfs_ext_store_pblock(&nex, pblock);
+       nex.ee_len = cpu_to_le16(count);
+       err = ldiskfs_ext_insert_extent(handle, inode, path, &nex, 0);
+       if (err) {
+               /* free data blocks we just allocated */
+               /* not a good idea to call discard here directly,
+                * but otherwise we'd need to call it every free() */
+               ldiskfs_discard_preallocations(inode);
+#ifdef HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD /* Introduced in 2.6.32-rc7 */
+               ldiskfs_free_blocks(handle, inode, NULL, ldiskfs_ext_pblock(&nex),
+                                   cpu_to_le16(nex.ee_len), 0);
+#else
+               ldiskfs_free_blocks(handle, inode, ldiskfs_ext_pblock(&nex),
+                                   cpu_to_le16(nex.ee_len), 0);
+#endif
+               goto out;
+       }
+
+       /*
+        * Putting len of the actual extent we just inserted,
+        * we are asking ldiskfs_ext_walk_space() to continue
+        * scaning after that block
+        */
+       cex->ec_len = le16_to_cpu(nex.ee_len);
+       cex->ec_start = ldiskfs_ext_pblock(&nex);
+       BUG_ON(le16_to_cpu(nex.ee_len) == 0);
+       BUG_ON(le32_to_cpu(nex.ee_block) != cex->ec_block);
+
+out:
+       up_write((&LDISKFS_I(inode)->i_data_sem));
+       ldiskfs_journal_stop(handle);
+map:
+       if (err >= 0) {
+               /* map blocks */
+               if (bp->num == 0) {
+                       CERROR("hmm. why do we find this extent?\n");
+                       CERROR("initial space: %lu:%u\n",
+                               bp->start, bp->init_num);
+#ifdef LDISKFS_EXT_CACHE_EXTENT /* until kernel 2.6.37 */
+                       CERROR("current extent: %u/%u/%llu %d\n",
+                               cex->ec_block, cex->ec_len,
+                               (unsigned long long)cex->ec_start,
+                               cex->ec_type);
+#else
+                       CERROR("current extent: %u/%u/%llu\n",
+                               cex->ec_block, cex->ec_len,
+                               (unsigned long long)cex->ec_start);
+#endif
+               }
+               i = 0;
+               if (cex->ec_block < bp->start)
+                       i = bp->start - cex->ec_block;
+               if (i >= cex->ec_len)
+                       CERROR("nothing to do?! i = %d, e_num = %u\n",
+                                       i, cex->ec_len);
+               for (; i < cex->ec_len && bp->num; i++) {
+                       *(bp->blocks) = cex->ec_start + i;
+#ifdef LDISKFS_EXT_CACHE_EXTENT /* until kernel 2.6.37 */
+                       if (cex->ec_type != LDISKFS_EXT_CACHE_EXTENT) {
+#else
+                       if ((cex->ec_len == 0) || (cex->ec_start == 0)) {
+#endif
+                               /* unmap any possible underlying metadata from
+                                * the block device mapping.  bug 6998. */
+                               unmap_underlying_metadata(inode->i_sb->s_bdev,
+                                                         *(bp->blocks));
+                       }
+                       bp->blocks++;
+                       bp->num--;
+                       bp->start++;
+               }
+       }
+       return err;
+}
+
+int osd_ldiskfs_map_nblocks(struct inode *inode, unsigned long block,
+                           unsigned long num, unsigned long *blocks,
+                           int create)
+{
+       struct bpointers bp;
+       int err;
+
+       CDEBUG(D_OTHER, "blocks %lu-%lu requested for inode %u\n",
+              block, block + num - 1, (unsigned) inode->i_ino);
+
+       bp.blocks = blocks;
+       bp.start = block;
+       bp.init_num = bp.num = num;
+       bp.create = create;
+
+       err = ldiskfs_ext_walk_space(inode, block, num,
+                                        ldiskfs_ext_new_extent_cb, &bp);
+       ldiskfs_ext_invalidate_cache(inode);
+
+       return err;
+}
+
+int osd_ldiskfs_map_ext_inode_pages(struct inode *inode, struct page **page,
+                                   int pages, unsigned long *blocks,
+                                   int create)
+{
+       int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits;
+       int rc = 0, i = 0;
+       struct page *fp = NULL;
+       int clen = 0;
+
+       CDEBUG(D_OTHER, "inode %lu: map %d pages from %lu\n",
+               inode->i_ino, pages, (*page)->index);
+
+       /* pages are sorted already. so, we just have to find
+        * contig. space and process them properly */
+       while (i < pages) {
+               if (fp == NULL) {
+                       /* start new extent */
+                       fp = *page++;
+                       clen = 1;
+                       i++;
+                       continue;
+               } else if (fp->index + clen == (*page)->index) {
+                       /* continue the extent */
+                       page++;
+                       clen++;
+                       i++;
+                       continue;
+               }
+
+               /* process found extent */
+               rc = osd_ldiskfs_map_nblocks(inode, fp->index * blocks_per_page,
+                                            clen * blocks_per_page, blocks,
+                                            create);
+               if (rc)
+                       GOTO(cleanup, rc);
+
+               /* look for next extent */
+               fp = NULL;
+               blocks += blocks_per_page * clen;
+       }
+
+       if (fp)
+               rc = osd_ldiskfs_map_nblocks(inode, fp->index * blocks_per_page,
+                                            clen * blocks_per_page, blocks,
+                                            create);
+cleanup:
+       return rc;
+}
+
+int osd_ldiskfs_map_bm_inode_pages(struct inode *inode, struct page **page,
+                                  int pages, unsigned long *blocks,
+                                  int create)
+{
+       int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits;
+       unsigned long *b;
+       int rc = 0, i;
+
+       for (i = 0, b = blocks; i < pages; i++, page++) {
+               rc = ldiskfs_map_inode_page(inode, *page, b, create);
+               if (rc) {
+                       CERROR("ino %lu, blk %lu create %d: rc %d\n",
+                              inode->i_ino, *b, create, rc);
+                       break;
+               }
+
+               b += blocks_per_page;
+       }
+       return rc;
+}
+
+static int osd_ldiskfs_map_inode_pages(struct inode *inode, struct page **page,
+                                      int pages, unsigned long *blocks,
+                                      int create, struct mutex *optional_mutex)
+{
+       int rc;
+
+       if (LDISKFS_I(inode)->i_flags & LDISKFS_EXTENTS_FL) {
+               rc = osd_ldiskfs_map_ext_inode_pages(inode, page, pages,
+                                                    blocks, create);
+               return rc;
+       }
+       if (optional_mutex != NULL)
+               mutex_lock(optional_mutex);
+       rc = osd_ldiskfs_map_bm_inode_pages(inode, page, pages, blocks, create);
+       if (optional_mutex != NULL)
+               mutex_unlock(optional_mutex);
+
+       return rc;
+}
+
 static int osd_write_prep(const struct lu_env *env, struct dt_object *dt,
                           struct niobuf_local *lnb, int npages)
 {
@@ -585,10 +923,10 @@ static int osd_write_prep(const struct lu_env *env, struct dt_object *dt,
        lprocfs_counter_add(osd->od_stats, LPROC_OSD_GET_PAGE, timediff);
 
         if (iobuf->dr_npages) {
-               rc = osd->od_fsops->fs_map_inode_pages(inode, iobuf->dr_pages,
-                                                      iobuf->dr_npages,
-                                                      iobuf->dr_blocks,
-                                                      0, NULL);
+               rc = osd_ldiskfs_map_inode_pages(inode, iobuf->dr_pages,
+                                                iobuf->dr_npages,
+                                                iobuf->dr_blocks,
+                                                0, NULL);
                 if (likely(rc == 0)) {
                         rc = osd_do_bio(osd, inode, iobuf);
                         /* do IO stats for preparation reads */
@@ -789,10 +1127,10 @@ static int osd_write_commit(const struct lu_env *env, struct dt_object *dt,
         if (OBD_FAIL_CHECK(OBD_FAIL_OST_MAPBLK_ENOSPC)) {
                 rc = -ENOSPC;
         } else if (iobuf->dr_npages > 0) {
-                rc = osd->od_fsops->fs_map_inode_pages(inode, iobuf->dr_pages,
-                                                      iobuf->dr_npages,
-                                                      iobuf->dr_blocks,
-                                                      1, NULL);
+               rc = osd_ldiskfs_map_inode_pages(inode, iobuf->dr_pages,
+                                                iobuf->dr_npages,
+                                                iobuf->dr_blocks,
+                                                1, NULL);
         } else {
                 /* no pages to write, no transno is needed */
                 thandle->th_local = 1;
@@ -877,10 +1215,10 @@ static int osd_read_prep(const struct lu_env *env, struct dt_object *dt,
        lprocfs_counter_add(osd->od_stats, LPROC_OSD_GET_PAGE, timediff);
 
         if (iobuf->dr_npages) {
-               rc = osd->od_fsops->fs_map_inode_pages(inode, iobuf->dr_pages,
-                                                      iobuf->dr_npages,
-                                                      iobuf->dr_blocks,
-                                                      0, NULL);
+               rc = osd_ldiskfs_map_inode_pages(inode, iobuf->dr_pages,
+                                                iobuf->dr_npages,
+                                                iobuf->dr_blocks,
+                                                0, NULL);
                 rc = osd_do_bio(osd, inode, iobuf);
 
                 /* IO stats will be done in osd_bufs_put() */
index ec9416d..3735e6d 100644 (file)
@@ -13,7 +13,7 @@ ptlrpc_objs := client.o recover.o connection.o niobuf.o pack_generic.o
 ptlrpc_objs += events.o ptlrpc_module.o service.o pinger.o
 ptlrpc_objs += llog_net.o llog_client.o llog_server.o import.o ptlrpcd.o
 ptlrpc_objs += pers.o lproc_ptlrpc.o wiretest.o layout.o
-ptlrpc_objs += sec.o sec_bulk.o sec_gc.o sec_config.o sec_lproc.o
+ptlrpc_objs += sec.o sec_ctx.o sec_bulk.o sec_gc.o sec_config.o sec_lproc.o
 ptlrpc_objs += sec_null.o sec_plain.o nrs.o nrs_fifo.o nrs_crr.o nrs_orr.o
 ptlrpc_objs += errno.o
 
index 255fca9..8db5c73 100644 (file)
@@ -51,7 +51,7 @@ LDLM_COMM_SOURCES= $(top_srcdir)/lustre/ldlm/l_lock.c \
        $(top_srcdir)/lustre/ldlm/ldlm_pool.c
 
 COMMON_SOURCES = client.c recover.c connection.c niobuf.c pack_generic.c       \
-       events.c ptlrpc_module.c service.c pinger.c llog_net.c                 \
+       events.c ptlrpc_module.c service.c pinger.c llog_net.c sec_ctx.c       \
        llog_client.c llog_server.c import.c ptlrpcd.c pers.c wiretest.c       \
        ptlrpc_internal.h layout.c sec.c sec_bulk.c sec_gc.c sec_config.c      \
        sec_lproc.c sec_null.c sec_plain.c lproc_ptlrpc.c nrs.c nrs_fifo.c     \
diff --git a/lustre/ptlrpc/sec_ctx.c b/lustre/ptlrpc/sec_ctx.c
new file mode 100644 (file)
index 0000000..8f4deb3
--- /dev/null
@@ -0,0 +1,215 @@
+/*
+ * 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.gnu.org/licenses/gpl-2.0.html
+ *
+ * GPL HEADER END
+ */
+#ifdef __KERNEL__
+
+#define DEBUG_SUBSYSTEM S_FILTER
+
+#include <linux/version.h>
+#include <linux/fs.h>
+#include <asm/unistd.h>
+#include <linux/slab.h>
+#include <linux/pagemap.h>
+#include <linux/quotaops.h>
+#include <linux/version.h>
+#include <libcfs/libcfs.h>
+#include <obd.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/lustre_compat25.h>
+#include <lvfs.h>
+
+#include <obd.h>
+#include <lustre_lib.h>
+
+/* refine later and change to seqlock or simlar from libcfs */
+/* Debugging check only needed during development */
+#ifdef OBD_CTXT_DEBUG
+# define ASSERT_CTXT_MAGIC(magic) LASSERT((magic) == OBD_RUN_CTXT_MAGIC)
+# define ASSERT_NOT_KERNEL_CTXT(msg) LASSERTF(!segment_eq(get_fs(), get_ds()),\
+                                             msg)
+# define ASSERT_KERNEL_CTXT(msg) LASSERTF(segment_eq(get_fs(), get_ds()), msg)
+#else
+# define ASSERT_CTXT_MAGIC(magic) do {} while(0)
+# define ASSERT_NOT_KERNEL_CTXT(msg) do {} while(0)
+# define ASSERT_KERNEL_CTXT(msg) do {} while(0)
+#endif
+
+static void push_group_info(struct lvfs_run_ctxt *save,
+                           struct group_info *ginfo)
+{
+       if (!ginfo) {
+               save->ngroups = current_ngroups;
+               current_ngroups = 0;
+       } else {
+               struct cred *cred;
+               task_lock(current);
+               save->group_info = current_cred()->group_info;
+               if ((cred = prepare_creds())) {
+                       cred->group_info = ginfo;
+                       commit_creds(cred);
+               }
+               task_unlock(current);
+       }
+}
+
+static void pop_group_info(struct lvfs_run_ctxt *save,
+                          struct group_info *ginfo)
+{
+       if (!ginfo) {
+               current_ngroups = save->ngroups;
+       } else {
+               struct cred *cred;
+               task_lock(current);
+               if ((cred = prepare_creds())) {
+                       cred->group_info = save->group_info;
+                       commit_creds(cred);
+               }
+               task_unlock(current);
+       }
+}
+
+/* push / pop to root of obd store */
+void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx,
+              struct lvfs_ucred *uc)
+{
+       /* if there is underlaying dt_device then push_ctxt is not needed */
+       if (new_ctx->dt != NULL)
+               return;
+
+       //ASSERT_NOT_KERNEL_CTXT("already in kernel context!\n");
+       ASSERT_CTXT_MAGIC(new_ctx->magic);
+       OBD_SET_CTXT_MAGIC(save);
+
+       save->fs = get_fs();
+       LASSERT(d_refcount(current->fs->pwd.dentry));
+       LASSERT(d_refcount(new_ctx->pwd));
+       save->pwd = dget(current->fs->pwd.dentry);
+       save->pwdmnt = mntget(current->fs->pwd.mnt);
+       save->luc.luc_umask = current_umask();
+       save->ngroups = current_cred()->group_info->ngroups;
+
+       LASSERT(save->pwd);
+       LASSERT(save->pwdmnt);
+       LASSERT(new_ctx->pwd);
+       LASSERT(new_ctx->pwdmnt);
+
+       if (uc) {
+               struct cred *cred;
+               save->luc.luc_uid = current_uid();
+               save->luc.luc_gid = current_gid();
+               save->luc.luc_fsuid = current_fsuid();
+               save->luc.luc_fsgid = current_fsgid();
+               save->luc.luc_cap = current_cap();
+
+               if ((cred = prepare_creds())) {
+                       cred->uid = uc->luc_uid;
+                       cred->gid = uc->luc_gid;
+                       cred->fsuid = uc->luc_fsuid;
+                       cred->fsgid = uc->luc_fsgid;
+                       cred->cap_effective = uc->luc_cap;
+                       commit_creds(cred);
+               }
+
+               push_group_info(save,
+                               uc->luc_ginfo ?:
+                               uc->luc_identity ? uc->luc_identity->mi_ginfo :
+                                                  NULL);
+       }
+       current->fs->umask = 0; /* umask already applied on client */
+       set_fs(new_ctx->fs);
+       ll_set_fs_pwd(current->fs, new_ctx->pwdmnt, new_ctx->pwd);
+}
+EXPORT_SYMBOL(push_ctxt);
+
+void pop_ctxt(struct lvfs_run_ctxt *saved, struct lvfs_run_ctxt *new_ctx,
+             struct lvfs_ucred *uc)
+{
+       /* if there is underlaying dt_device then pop_ctxt is not needed */
+       if (new_ctx->dt != NULL)
+               return;
+
+       ASSERT_CTXT_MAGIC(saved->magic);
+       ASSERT_KERNEL_CTXT("popping non-kernel context!\n");
+
+       LASSERTF(current->fs->pwd.dentry == new_ctx->pwd, "%p != %p\n",
+                current->fs->pwd.dentry, new_ctx->pwd);
+       LASSERTF(current->fs->pwd.mnt == new_ctx->pwdmnt, "%p != %p\n",
+                current->fs->pwd.mnt, new_ctx->pwdmnt);
+
+       set_fs(saved->fs);
+       ll_set_fs_pwd(current->fs, saved->pwdmnt, saved->pwd);
+
+       dput(saved->pwd);
+       mntput(saved->pwdmnt);
+       current->fs->umask = saved->luc.luc_umask;
+       if (uc) {
+               struct cred *cred;
+               if ((cred = prepare_creds())) {
+                       cred->uid = saved->luc.luc_uid;
+                       cred->gid = saved->luc.luc_gid;
+                       cred->fsuid = saved->luc.luc_fsuid;
+                       cred->fsgid = saved->luc.luc_fsgid;
+                       cred->cap_effective = saved->luc.luc_cap;
+                       commit_creds(cred);
+               }
+
+               pop_group_info(saved,
+                              uc->luc_ginfo ?:
+                              uc->luc_identity ? uc->luc_identity->mi_ginfo :
+                                                 NULL);
+       }
+}
+EXPORT_SYMBOL(pop_ctxt);
+
+/* utility to rename a file */
+int lustre_rename(struct dentry *dir, struct vfsmount *mnt,
+                 char *oldname, char *newname)
+{
+       struct dentry *dchild_old, *dchild_new;
+       int err = 0;
+       ENTRY;
+
+       ASSERT_KERNEL_CTXT("kernel doing rename outside kernel context\n");
+       CDEBUG(D_INODE, "renaming file %.*s to %.*s\n",
+              (int)strlen(oldname), oldname, (int)strlen(newname), newname);
+
+       dchild_old = ll_lookup_one_len(oldname, dir, strlen(oldname));
+       if (IS_ERR(dchild_old))
+               RETURN(PTR_ERR(dchild_old));
+
+       if (!dchild_old->d_inode)
+               GOTO(put_old, err = -ENOENT);
+
+       dchild_new = ll_lookup_one_len(newname, dir, strlen(newname));
+       if (IS_ERR(dchild_new))
+               GOTO(put_old, err = PTR_ERR(dchild_new));
+
+       err = vfs_rename(dir->d_inode, dchild_old, dir->d_inode, dchild_new);
+
+       dput(dchild_new);
+put_old:
+       dput(dchild_old);
+       RETURN(err);
+}
+EXPORT_SYMBOL(lustre_rename);
+#endif /* __KERNEL__ */
index 62cbb39..f4aacf3 100644 (file)
@@ -37,7 +37,6 @@ declare -r BOTTOM_MODULES=(   \
        ksocklnd                \
        kqswlnd                 \
        ko2iblnd                \
-       fsfilt_ldiskfs          \
        obdclass                \
        lnet                    \
        lvfs                    \
index 0478ceb..9e1deb6 100644 (file)
@@ -6775,7 +6775,7 @@ test_117() # bug 10891
         echo "Truncate succeeded."
        rm -f $DIR/$tfile
 }
-run_test 117 "verify fsfilt_extend =========="
+run_test 117 "verify osd extend =========="
 
 NO_SLOW_RESENDCOUNT=4
 export OLD_RESENDCOUNT=""
index d516313..9b8737a 100644 (file)
@@ -475,7 +475,6 @@ load_modules_local() {
     load_module ../lnet/lnet/lnet
     LNETLND=${LNETLND:-"socklnd/ksocklnd"}
     load_module ../lnet/klnds/$LNETLND
-    load_module lvfs/lvfs
     load_module obdclass/obdclass
     load_module ptlrpc/ptlrpc
     load_module ptlrpc/gss/ptlrpc_gss
@@ -498,19 +497,14 @@ load_modules_local() {
                        modprobe zfs
                        load_module osd-zfs/osd_zfs
                fi
-               load_module mgs/mgs
-               load_module mdd/mdd
                if [[ $(node_fstypes $HOSTNAME) == *ldiskfs* ]]; then
-                       #
-                       # This block shall be moved up beside osd-zfs as soon
-                       # as osd-ldiskfs stops using mdd symbols.
-                       #
                        grep -q exportfs_decode_fh $SYMLIST ||
                                { modprobe exportfs 2> /dev/null || true; }
                        load_module ../ldiskfs/ldiskfs
-                       load_module lvfs/fsfilt_ldiskfs
                        load_module osd-ldiskfs/osd_ldiskfs
                fi
+               load_module mgs/mgs
+               load_module mdd/mdd
                load_module mdt/mdt
                load_module ost/ost
                load_module lod/lod