X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Flvfs%2Flvfs_linux.c;h=6573f35600cead367d0e7f62c472e00436fdac66;hp=fbd038d06bcc6926e017e49db2a7e2eb456f0d4b;hb=d10c9e05ab593f361fdfd27842766a1924e63e58;hpb=6dbf1ffdec1240fbc8a86210b439d31a6c80c8de diff --git a/lustre/lvfs/lvfs_linux.c b/lustre/lvfs/lvfs_linux.c index fbd038d..6573f35 100644 --- a/lustre/lvfs/lvfs_linux.c +++ b/lustre/lvfs/lvfs_linux.c @@ -1,6 +1,4 @@ -/* -*- 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. @@ -26,8 +24,10 @@ * GPL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2011, 2012, Whamcloud, Inc. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -38,10 +38,6 @@ * Author: Andreas Dilger */ -#ifndef EXPORT_SYMTAB -# define EXPORT_SYMTAB -#endif - #define DEBUG_SUBSYSTEM S_FILTER #include @@ -67,6 +63,7 @@ __u64 obd_max_pages = 0; __u64 obd_max_alloc = 0; struct lprocfs_stats *obd_memory = NULL; +EXPORT_SYMBOL(obd_memory); cfs_spinlock_t obd_updatemax_lock = CFS_SPIN_LOCK_UNLOCKED; /* refine later and change to seqlock or simlar from libcfs */ @@ -125,11 +122,11 @@ void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx, OBD_SET_CTXT_MAGIC(save); save->fs = get_fs(); - LASSERT(cfs_atomic_read(&cfs_fs_pwd(current->fs)->d_count)); - LASSERT(cfs_atomic_read(&new_ctx->pwd->d_count)); + LASSERT(d_refcount(cfs_fs_pwd(current->fs))); + LASSERT(d_refcount(new_ctx->pwd)); save->pwd = dget(cfs_fs_pwd(current->fs)); save->pwdmnt = mntget(cfs_fs_mnt(current->fs)); - save->luc.luc_umask = current->fs->umask; + save->luc.luc_umask = cfs_curproc_umask(); save->ngroups = current_cred()->group_info->ngroups; LASSERT(save->pwd); @@ -375,7 +372,7 @@ int lustre_fsync(struct file *file) if (!file || !file->f_op || !file->f_op->fsync) RETURN(-ENOSYS); - RETURN(file->f_op->fsync(file, file->f_dentry, 0)); + RETURN(cfs_do_fsync(file, 0)); } EXPORT_SYMBOL(lustre_fsync); @@ -388,13 +385,8 @@ struct l_file *l_dentry_open(struct lvfs_run_ctxt *ctxt, struct l_dentry *de, } EXPORT_SYMBOL(l_dentry_open); -#ifdef HAVE_VFS_READDIR_U64_INO static int l_filldir(void *__buf, const char *name, int namlen, loff_t offset, u64 ino, unsigned int d_type) -#else -static int l_filldir(void *__buf, const char *name, int namlen, loff_t offset, - ino_t ino, unsigned int d_type) -#endif { struct l_linux_dirent *dirent; struct l_readdir_callback *buf = (struct l_readdir_callback *)__buf; @@ -491,15 +483,9 @@ out: } EXPORT_SYMBOL(simple_truncate); -#ifdef LUSTRE_KERNEL_VERSION -#ifndef HAVE_CLEAR_RDONLY_ON_PUT -#error rdonly patchset must be updated [cfs bz11248] -#endif -void dev_set_rdonly(lvfs_sbdev_type dev); -int dev_check_rdonly(lvfs_sbdev_type dev); - -void __lvfs_set_rdonly(lvfs_sbdev_type dev, lvfs_sbdev_type jdev) +int __lvfs_set_rdonly(lvfs_sbdev_type dev, lvfs_sbdev_type jdev) { +#ifdef HAVE_DEV_SET_RDONLY if (jdev && (jdev != dev)) { CDEBUG(D_IOCTL | D_HA, "set journal dev %lx rdonly\n", (long)jdev); @@ -507,14 +493,24 @@ void __lvfs_set_rdonly(lvfs_sbdev_type dev, lvfs_sbdev_type jdev) } CDEBUG(D_IOCTL | D_HA, "set dev %lx rdonly\n", (long)dev); dev_set_rdonly(dev); + + return 0; +#else + CERROR("DEV %lx CANNOT BE SET READONLY\n", (long)dev); + + return -EOPNOTSUPP; +#endif } +EXPORT_SYMBOL(__lvfs_set_rdonly); int lvfs_check_rdonly(lvfs_sbdev_type dev) { +#ifdef HAVE_DEV_SET_RDONLY return dev_check_rdonly(dev); +#else + return 0; +#endif } - -EXPORT_SYMBOL(__lvfs_set_rdonly); EXPORT_SYMBOL(lvfs_check_rdonly); int lvfs_check_io_health(struct obd_device *obd, struct file *file) @@ -536,7 +532,6 @@ int lvfs_check_io_health(struct obd_device *obd, struct file *file) RETURN(rc); } EXPORT_SYMBOL(lvfs_check_io_health); -#endif /* LUSTRE_KERNEL_VERSION */ void obd_update_maxusage() { @@ -553,6 +548,7 @@ void obd_update_maxusage() cfs_spin_unlock(&obd_updatemax_lock); } +EXPORT_SYMBOL(obd_update_maxusage); __u64 obd_memory_max(void) { @@ -564,6 +560,7 @@ __u64 obd_memory_max(void) return ret; } +EXPORT_SYMBOL(obd_memory_max); __u64 obd_pages_max(void) { @@ -575,11 +572,7 @@ __u64 obd_pages_max(void) return ret; } - -EXPORT_SYMBOL(obd_update_maxusage); EXPORT_SYMBOL(obd_pages_max); -EXPORT_SYMBOL(obd_memory_max); -EXPORT_SYMBOL(obd_memory); #ifdef LPROCFS __s64 lprocfs_read_helper(struct lprocfs_counter *lc,