From 400b9d87c9c644769f59dfffe140e5f2c37898ac Mon Sep 17 00:00:00 2001 From: green Date: Sun, 29 May 2005 07:51:24 +0000 Subject: [PATCH] Branch: b1_4 b=3790 r=adilger Introudce fsprivate member of struct file, to be used as filesystem's private data pointer --- lustre/kernel_patches/patches/fsprivate-2.4-suse.patch | 10 ++++++++++ lustre/kernel_patches/patches/fsprivate-2.4.patch | 10 ++++++++++ lustre/kernel_patches/patches/fsprivate-2.6.patch | 10 ++++++++++ lustre/kernel_patches/patches/lustre_version.patch | 3 ++- lustre/kernel_patches/series/2.6-fc3.series | 1 + lustre/kernel_patches/series/2.6-rhel4.series | 1 + lustre/kernel_patches/series/2.6-suse-lnxi.series | 1 + lustre/kernel_patches/series/rhel-2.4.21 | 1 + lustre/kernel_patches/series/suse-2.4.21-cray | 1 + lustre/kernel_patches/series/suse-2.4.21-jvn | 1 + lustre/kernel_patches/series/vanilla-2.4.24 | 1 + lustre/kernel_patches/series/vanilla-2.4.29 | 1 + lustre/llite/file.c | 18 +++++++++--------- lustre/llite/llite_internal.h | 8 ++++++++ lustre/llite/llite_mmap.c | 2 +- lustre/llite/rw.c | 2 +- lustre/obdclass/class_obd.c | 2 +- lustre/tests/sanity.sh | 9 +++++++++ 18 files changed, 69 insertions(+), 13 deletions(-) create mode 100644 lustre/kernel_patches/patches/fsprivate-2.4-suse.patch create mode 100644 lustre/kernel_patches/patches/fsprivate-2.4.patch create mode 100644 lustre/kernel_patches/patches/fsprivate-2.6.patch diff --git a/lustre/kernel_patches/patches/fsprivate-2.4-suse.patch b/lustre/kernel_patches/patches/fsprivate-2.4-suse.patch new file mode 100644 index 0000000..fc3a72a --- /dev/null +++ b/lustre/kernel_patches/patches/fsprivate-2.4-suse.patch @@ -0,0 +1,10 @@ +--- uml-2.4.24/include/linux/fs.h.orig 2005-05-18 21:27:58.120742112 +0300 ++++ uml-2.4.24/include/linux/fs.h 2005-05-18 22:48:12.081908776 +0300 +@@ -592,6 +592,7 @@ + /* needed for tty driver, and maybe others */ + void *private_data; + struct lookup_intent *f_it; ++ void *fs_private; + struct list_head f_ep_links; + spinlock_t f_ep_lock; + }; diff --git a/lustre/kernel_patches/patches/fsprivate-2.4.patch b/lustre/kernel_patches/patches/fsprivate-2.4.patch new file mode 100644 index 0000000..4e83dbe --- /dev/null +++ b/lustre/kernel_patches/patches/fsprivate-2.4.patch @@ -0,0 +1,10 @@ +--- uml-2.4.24/include/linux/fs.h.orig 2005-05-18 21:27:58.120742112 +0300 ++++ uml-2.4.24/include/linux/fs.h 2005-05-18 22:48:12.081908776 +0300 +@@ -592,6 +592,7 @@ + /* needed for tty driver, and maybe others */ + void *private_data; + struct lookup_intent *f_it; ++ void *fs_private; + + /* preallocated helper kiobuf to speedup O_DIRECT */ + struct kiobuf *f_iobuf; diff --git a/lustre/kernel_patches/patches/fsprivate-2.6.patch b/lustre/kernel_patches/patches/fsprivate-2.6.patch new file mode 100644 index 0000000..a5c3d48 --- /dev/null +++ b/lustre/kernel_patches/patches/fsprivate-2.6.patch @@ -0,0 +1,10 @@ +--- linux-2.6.5-7.141/include/linux/fs.h.orig 2005-02-01 23:56:07.000000000 +0200 ++++ linux-2.6.5-7.141/include/linux/fs.h 2005-05-18 23:23:15.486142728 +0300 +@@ -574,6 +574,7 @@ + #endif /* #ifdef CONFIG_EPOLL */ + struct address_space *f_mapping; + struct lookup_intent *f_it; ++ void *fs_private; + }; + extern spinlock_t files_lock; + #define file_list_lock() spin_lock(&files_lock); diff --git a/lustre/kernel_patches/patches/lustre_version.patch b/lustre/kernel_patches/patches/lustre_version.patch index aa8c735..6a9810b 100644 --- a/lustre/kernel_patches/patches/lustre_version.patch +++ b/lustre/kernel_patches/patches/lustre_version.patch @@ -1,3 +1,4 @@ +Version 46: Separate ->fs_private in struct file Version 45: more robust and general dev_read_only for failover (b=4834) Version 44: fix link_path_walk_it() oops creating .foo in deleted "." (b=5548) Version 43: fix remove_suid to not crash 2.6, and do anything on 2.4 (b=5695) @@ -19,6 +20,6 @@ Version 34: ext3 iopen assertion (b=2517), operations on deleted "." (b=2399) --- /dev/null Fri Aug 30 17:31:37 2002 +++ linux-2.4.18-18.8.0-l12-braam/include/linux/lustre_version.h Thu Feb 13 07:58:33 2003 @@ -0,0 +1 @@ -+#define LUSTRE_KERNEL_VERSION 45 ++#define LUSTRE_KERNEL_VERSION 46 _ diff --git a/lustre/kernel_patches/series/2.6-fc3.series b/lustre/kernel_patches/series/2.6-fc3.series index 2d34eb9..4b6e21f 100644 --- a/lustre/kernel_patches/series/2.6-fc3.series +++ b/lustre/kernel_patches/series/2.6-fc3.series @@ -18,3 +18,4 @@ jbd-2.6.10-jcberr.patch hostfs_readdir_large.patch ext3-patch-fuzz-fixup-fc3.patch uml-exprt-clearuser.patch +fsprivate-2.6.patch diff --git a/lustre/kernel_patches/series/2.6-rhel4.series b/lustre/kernel_patches/series/2.6-rhel4.series index 46487e1..e523bb3 100644 --- a/lustre/kernel_patches/series/2.6-rhel4.series +++ b/lustre/kernel_patches/series/2.6-rhel4.series @@ -14,3 +14,4 @@ lookup_bdev_init_intent.patch remove-suid-2.6-suse.patch export-show_task-2.6-vanilla.patch sd_iostats-2.6-rhel4.patch +fsprivate-2.6.patch diff --git a/lustre/kernel_patches/series/2.6-suse-lnxi.series b/lustre/kernel_patches/series/2.6-suse-lnxi.series index df6c26c..86a2b59 100644 --- a/lustre/kernel_patches/series/2.6-suse-lnxi.series +++ b/lustre/kernel_patches/series/2.6-suse-lnxi.series @@ -11,3 +11,4 @@ remove-suid-2.6-suse.patch link_notlast-susefix.patch uml-exprt-clearuser.patch qsnet-suse-2.6.patch +fsprivate-2.6.patch diff --git a/lustre/kernel_patches/series/rhel-2.4.21 b/lustre/kernel_patches/series/rhel-2.4.21 index 7340b89..53e17a1 100644 --- a/lustre/kernel_patches/series/rhel-2.4.21 +++ b/lustre/kernel_patches/series/rhel-2.4.21 @@ -47,3 +47,4 @@ compile-fixes-2.4.21-rhel.patch grab_cache_page_nowait_gfp-rh-2.4.patch remove-suid-2.4-rhel.patch qsnet-rhel-2.4.patch +fsprivate-2.4.patch diff --git a/lustre/kernel_patches/series/suse-2.4.21-cray b/lustre/kernel_patches/series/suse-2.4.21-cray index 20fab4c..12ca06b 100644 --- a/lustre/kernel_patches/series/suse-2.4.21-cray +++ b/lustre/kernel_patches/series/suse-2.4.21-cray @@ -32,3 +32,4 @@ ext3-truncate-buffer-head.patch loop-sync-2.4.21-suse.patch ext3-extents-2.4.21-suse2.patch ext3-extents-asyncdel-2.4.24.patch +fsprivate-2.4-suse.patch diff --git a/lustre/kernel_patches/series/suse-2.4.21-jvn b/lustre/kernel_patches/series/suse-2.4.21-jvn index d6bd7ed..21301e7 100644 --- a/lustre/kernel_patches/series/suse-2.4.21-jvn +++ b/lustre/kernel_patches/series/suse-2.4.21-jvn @@ -27,3 +27,4 @@ ext3-ea-in-inode-2.4.21-sles.patch listman-2.4.20.patch ext3-truncate-buffer-head.patch lookup-stack-symbols-2.4.21-suse-171.patch +fsprivate-2.4-suse.patch diff --git a/lustre/kernel_patches/series/vanilla-2.4.24 b/lustre/kernel_patches/series/vanilla-2.4.24 index cba0f22..6039450 100644 --- a/lustre/kernel_patches/series/vanilla-2.4.24 +++ b/lustre/kernel_patches/series/vanilla-2.4.24 @@ -44,3 +44,4 @@ export-zap-page-range.patch uml-sigusr1-2.4-vanilla.patch remove-suid-2.4-rhel.patch uml-exprt-clearuser.patch +fsprivate-2.4.patch diff --git a/lustre/kernel_patches/series/vanilla-2.4.29 b/lustre/kernel_patches/series/vanilla-2.4.29 index 7588fac..394dd49 100644 --- a/lustre/kernel_patches/series/vanilla-2.4.29 +++ b/lustre/kernel_patches/series/vanilla-2.4.29 @@ -39,3 +39,4 @@ export-show_task-2.4-vanilla.patch export-zap-page-range.patch remove-suid-2.4-rhel.patch kallsyms-2.4.29.patch +fsprivate-2.4.patch diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 40af36b..799b607 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -35,7 +35,7 @@ int ll_mdc_close(struct obd_export *mdc_exp, struct inode *inode, struct file *file) { - struct ll_file_data *fd = file->private_data; + struct ll_file_data *fd = LUSTRE_FPRIVATE(file); struct ptlrpc_request *req = NULL; struct obd_client_handle *och = &fd->fd_mds_och; struct obdo obdo; @@ -72,7 +72,7 @@ int ll_mdc_close(struct obd_export *mdc_exp, struct inode *inode, mdc_clear_open_replay_data(och); ptlrpc_req_finished(req); och->och_fh.cookie = DEAD_HANDLE_MAGIC; - file->private_data = NULL; + LUSTRE_FPRIVATE(file) = NULL; OBD_SLAB_FREE(fd, ll_file_data_slab, sizeof *fd); RETURN(rc); @@ -102,7 +102,7 @@ int ll_file_release(struct inode *inode, struct file *file) RETURN(0); lprocfs_counter_incr(sbi->ll_stats, LPROC_LL_RELEASE); - fd = (struct ll_file_data *)file->private_data; + fd = LUSTRE_FPRIVATE(file); LASSERT(fd != NULL); if (lsm) @@ -149,7 +149,7 @@ int ll_local_open(struct file *file, struct lookup_intent *it) LASSERT (body != NULL); /* reply already checked out */ LASSERT_REPSWABBED (req, 1); /* and swabbed down */ - LASSERT(!file->private_data); + LASSERT(!LUSTRE_FPRIVATE(file)); OBD_SLAB_ALLOC(fd, ll_file_data_slab, SLAB_KERNEL, sizeof *fd); /* We can't handle this well without reorganizing ll_file_open and @@ -158,7 +158,7 @@ int ll_local_open(struct file *file, struct lookup_intent *it) memcpy(&fd->fd_mds_och.och_fh, &body->handle, sizeof(body->handle)); fd->fd_mds_och.och_magic = OBD_CLIENT_HANDLE_MAGIC; - file->private_data = fd; + LUSTRE_FPRIVATE(file) = fd; ll_readahead_init(file->f_dentry->d_inode, &fd->fd_ras); lli->lli_io_epoch = body->io_epoch; @@ -802,7 +802,7 @@ static ssize_t ll_file_read(struct file *filp, char *buf, size_t count, } node = ll_node_from_inode(inode, *ppos, *ppos + count - 1, LCK_PR); - tree.lt_fd = filp->private_data; + tree.lt_fd = LUSTRE_FPRIVATE(filp); rc = ll_tree_lock(&tree, node, buf, count, filp->f_flags & O_NONBLOCK ? LDLM_FL_BLOCK_NOWAIT :0); if (rc != 0) @@ -876,7 +876,7 @@ static ssize_t ll_file_write(struct file *file, const char *buf, size_t count, if (IS_ERR(node)) RETURN(PTR_ERR(node)); - tree.lt_fd = file->private_data; + tree.lt_fd = LUSTRE_FPRIVATE(file); rc = ll_tree_lock(&tree, node, buf, count, file->f_flags & O_NONBLOCK ? LDLM_FL_BLOCK_NOWAIT :0); if (rc != 0) @@ -1088,7 +1088,7 @@ static int ll_lov_getstripe(struct inode *inode, unsigned long arg) int ll_file_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { - struct ll_file_data *fd = file->private_data; + struct ll_file_data *fd = LUSTRE_FPRIVATE(file); int flags; ENTRY; @@ -1147,7 +1147,7 @@ int ll_file_ioctl(struct inode *inode, struct file *file, unsigned int cmd, loff_t ll_file_seek(struct file *file, loff_t offset, int origin) { struct inode *inode = file->f_dentry->d_inode; - struct ll_file_data *fd = file->private_data; + struct ll_file_data *fd = LUSTRE_FPRIVATE(file); struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd; struct lustre_handle lockh = {0}; loff_t retval; diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 76b3463..d2f1ff0 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -6,6 +6,7 @@ #define LLITE_INTERNAL_H #include +#include /* struct lustre_intent_data { @@ -17,6 +18,13 @@ struct lustre_intent_data { #define LL_IT2STR(it) ((it) ? ldlm_it2str((it)->it_op) : "0") +#if (LUSTRE_KERNEL_VERSION < 46) +#define LUSTRE_FPRIVATE(file) ((file)->private_data) +#else +#define LUSTRE_FPRIVATE(file) ((file)->fs_private) +#endif + + static inline struct lookup_intent *ll_nd2it(struct nameidata *nd) { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) diff --git a/lustre/llite/llite_mmap.c b/lustre/llite/llite_mmap.c index 995a7de..573db13 100644 --- a/lustre/llite/llite_mmap.c +++ b/lustre/llite/llite_mmap.c @@ -362,7 +362,7 @@ struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address, #endif { struct file *filp = vma->vm_file; - struct ll_file_data *fd = filp->private_data; + struct ll_file_data *fd = LUSTRE_FPRIVATE(filp); struct inode *inode = filp->f_dentry->d_inode; struct lustre_handle lockh = { 0 }; ldlm_policy_data_t policy; diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 005a21d..396b8d5 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -1242,7 +1242,7 @@ out: */ int ll_readpage(struct file *filp, struct page *page) { - struct ll_file_data *fd = filp->private_data; + struct ll_file_data *fd = LUSTRE_FPRIVATE(filp); struct inode *inode = page->mapping->host; struct obd_export *exp; struct ll_async_page *llap; diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 2f92595..d1fd0a2 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -766,7 +766,7 @@ static void cleanup_obdclass(void) * kernel patch */ #include #define LUSTRE_MIN_VERSION 32 -#define LUSTRE_MAX_VERSION 45 +#define LUSTRE_MAX_VERSION 46 #if (LUSTRE_KERNEL_VERSION < LUSTRE_MIN_VERSION) # error Cannot continue: Your Lustre kernel patch is older than the sources #elif (LUSTRE_KERNEL_VERSION > LUSTRE_MAX_VERSION) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 22be758..8c540cc 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -1960,6 +1960,15 @@ test_54d() { } run_test 54d "fifo device works in lustre ======================" +test_54e() { + check_kernel_version 46 || return 0 + f="$DIR/f54e" + string="aaaaaa" + mknod $f c 4 0 + echo $string > $f || error +} +run_test 54e "console/tty device works in lustre ======================" + check_fstype() { grep -q $FSTYPE /proc/filesystems && return 1 modprobe $FSTYPE -- 1.8.3.1