All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Becker <Joel.Becker@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 07/30] ocfs2: Handle struct f_path in struct file
Date: Fri Dec 21 01:09:48 2007	[thread overview]
Message-ID: <20071221090915.GF18627@ca-server1.us.oracle.com> (raw)
In-Reply-To: <1198193387-16606-6-git-send-email-sunil.mushran@oracle.com>

On Thu, Dec 20, 2007 at 03:29:24PM -0800, Sunil Mushran wrote:
> Commit 0f7fc9e4d03987fe29f6dd4aa67e4c56eb7ecb05 in mainline added
> struct path in struct file. This patch allows one to build ocfs2 with
> kernels having/not having that change.
> 

Here again the define is reversed.

Thinking about the compat trick you did, I'm wondering if something like
this isn't a better idea:

#ifdef NO_F_PATH
# define filp_dentry(i) (i)->f_dentry
#else
# define filp_dentry(i) (i)->f_path.dentry
#endif
...
-	struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
+	struct inode *inode = filp_dentry(iocb->ki_filp)->d_inode;

Thoughs?  I'm not sold on it, just throwing it out there.

Joel

> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  Config.make.in              |    1 +
>  Makefile                    |    3 ++-
>  configure.in                |    6 ++++++
>  fs/ocfs2/Makefile           |    4 ++++
>  fs/ocfs2/aops.c             |    4 ++--
>  fs/ocfs2/dir.c              |    2 +-
>  fs/ocfs2/dlm/dlmfs.c        |    4 ++--
>  fs/ocfs2/file.c             |   38 +++++++++++++++++++-------------------
>  fs/ocfs2/ioctl.c            |    2 +-
>  fs/ocfs2/mmap.c             |    2 +-
>  kapi-compat/include/fpath.h |   10 ++++++++++
>  11 files changed, 49 insertions(+), 27 deletions(-)
>  create mode 100644 kapi-compat/include/fpath.h
> 
> diff --git a/Config.make.in b/Config.make.in
> index 1fe7ddc..4f42cca 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -60,6 +60,7 @@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@
>  DELAYED_WORK_DEFINED = @DELAYED_WORK_DEFINED@
>  
>  HAS_SYNC_MAPPING_RANGE  = @HAS_SYNC_MAPPING_RANGE@
> +HAS_F_PATH_DEFINED = @HAS_F_PATH_DEFINED@
>  
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
> diff --git a/Makefile b/Makefile
> index b7b86db..b00a6c4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -11,7 +11,8 @@ LINUX_INCLUDE_FILES =
>  KAPI_COMPAT_FILES = \
>  	kapi-compat/include/workqueue.h \
>  	kapi-compat/include/compiler.h \
> -	kapi-compat/include/highmem.h
> +	kapi-compat/include/highmem.h \
> +	kapi-compat/include/fpath.h
>  
>  PATCH_FILES =
>  
> diff --git a/configure.in b/configure.in
> index 603dc94..907c90f 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -177,6 +177,12 @@ OCFS2_CHECK_KERNEL([do_sync_mapping_range() in fs.h], fs.h,
>    HAS_SYNC_MAPPING_RANGE=yes, , [do_sync_mapping_range(])
>  AC_SUBST(HAS_SYNC_MAPPING_RANGE)
>  
> +HAS_F_PATH_DEFINED=
> +OCFS2_CHECK_KERNEL([f_path in fs.h], fs.h,
> +  HAS_F_PATH_DEFINED=yes, , [f_path])
> +AC_SUBST(HAS_F_PATH_DEFINED)
> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS fpath.h"
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> index 3dc33a5..b6c8d03 100644
> --- a/fs/ocfs2/Makefile
> +++ b/fs/ocfs2/Makefile
> @@ -33,6 +33,10 @@ ifdef HAS_SYNC_MAPPING_RANGE
>  EXTRA_CFLAGS += -DHAS_SYNC_MAPPING_RANGE
>  endif
>  
> +ifdef HAS_F_PATH_DEFINED
> +EXTRA_CFLAGS += -DHAS_F_PATH_DEFINED
> +endif
> +
>  #
>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>  # include trailing slashes.
> diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
> index 34d1045..96cb31b 100644
> --- a/fs/ocfs2/aops.c
> +++ b/fs/ocfs2/aops.c
> @@ -584,7 +584,7 @@ static void ocfs2_dio_end_io(struct kiocb *iocb,
>  			     ssize_t bytes,
>  			     void *private)
>  {
> -	struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
> +	struct inode *inode = iocb->ki_filp->f_path_dentry->d_inode;
>  	int level;
>  
>  	/* this io's submitter should not have unlocked this before we could */
> @@ -626,7 +626,7 @@ static ssize_t ocfs2_direct_IO(int rw,
>  			       unsigned long nr_segs)
>  {
>  	struct file *file = iocb->ki_filp;
> -	struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
> +	struct inode *inode = file->f_path_dentry->d_inode->i_mapping->host;
>  	int ret;
>  
>  	mlog_entry_void();
> diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
> index 7453b70..0764a66 100644
> --- a/fs/ocfs2/dir.c
> +++ b/fs/ocfs2/dir.c
> @@ -840,7 +840,7 @@ int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv,
>  int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir)
>  {
>  	int error = 0;
> -	struct inode *inode = filp->f_path.dentry->d_inode;
> +	struct inode *inode = filp->f_path_dentry->d_inode;
>  	int lock_level = 0;
>  
>  	mlog_entry("dirino=%llu\n",
> diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
> index 7418dc8..4ce2dea 100644
> --- a/fs/ocfs2/dlm/dlmfs.c
> +++ b/fs/ocfs2/dlm/dlmfs.c
> @@ -175,7 +175,7 @@ static ssize_t dlmfs_file_read(struct file *filp,
>  	int bytes_left;
>  	ssize_t readlen;
>  	char *lvb_buf;
> -	struct inode *inode = filp->f_path.dentry->d_inode;
> +	struct inode *inode = filp->f_path_dentry->d_inode;
>  
>  	mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
>  		inode->i_ino, count, *ppos);
> @@ -219,7 +219,7 @@ static ssize_t dlmfs_file_write(struct file *filp,
>  	int bytes_left;
>  	ssize_t writelen;
>  	char *lvb_buf;
> -	struct inode *inode = filp->f_path.dentry->d_inode;
> +	struct inode *inode = filp->f_path_dentry->d_inode;
>  
>  	mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
>  		inode->i_ino, count, *ppos);
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index a62b14e..adb10b9 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -70,7 +70,7 @@ static int ocfs2_file_open(struct inode *inode, struct file *file)
>  	struct ocfs2_inode_info *oi = OCFS2_I(inode);
>  
>  	mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file,
> -		   file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name);
> +		   file->f_path_dentry->d_name.len, file->f_path_dentry->d_name.name);
>  
>  	spin_lock(&oi->ip_lock);
>  
> @@ -100,8 +100,8 @@ static int ocfs2_file_release(struct inode *inode, struct file *file)
>  	struct ocfs2_inode_info *oi = OCFS2_I(inode);
>  
>  	mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file,
> -		       file->f_path.dentry->d_name.len,
> -		       file->f_path.dentry->d_name.name);
> +		       file->f_path_dentry->d_name.len,
> +		       file->f_path_dentry->d_name.name);
>  
>  	spin_lock(&oi->ip_lock);
>  	if (!--oi->ip_open_count)
> @@ -1663,7 +1663,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
>  		}
>  	}
>  
> -	if (file && should_remove_suid(file->f_path.dentry)) {
> +	if (file && should_remove_suid(file->f_path_dentry)) {
>  		ret = __ocfs2_write_remove_suid(inode, di_bh);
>  		if (ret) {
>  			mlog_errno(ret);
> @@ -1730,7 +1730,7 @@ out:
>  int ocfs2_change_file_space(struct file *file, unsigned int cmd,
>  			    struct ocfs2_space_resv *sr)
>  {
> -	struct inode *inode = file->f_path.dentry->d_inode;
> +	struct inode *inode = file->f_path_dentry->d_inode;
>  	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);;
>  
>  	if ((cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64) &&
> @@ -2023,12 +2023,12 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
>  	size_t count;		/* after file limit checks */
>  	loff_t *ppos = &iocb->ki_pos;
>  	struct file *file = iocb->ki_filp;
> -	struct inode *inode = file->f_path.dentry->d_inode;
> +	struct inode *inode = file->f_path_dentry->d_inode;
>  
>  	mlog_entry("(0x%p, %u, '%.*s')\n", file,
>  		   (unsigned int)nr_segs,
> -		   file->f_path.dentry->d_name.len,
> -		   file->f_path.dentry->d_name.name);
> +		   file->f_path_dentry->d_name.len,
> +		   file->f_path_dentry->d_name.name);
>  
>  	if (iocb->ki_left == 0)
>  		return 0;
> @@ -2062,7 +2062,7 @@ relock:
>  	}
>  
>  	can_do_direct = direct_io;
> -	ret = ocfs2_prepare_inode_for_write(file->f_path.dentry, ppos,
> +	ret = ocfs2_prepare_inode_for_write(file->f_path_dentry, ppos,
>  					    iocb->ki_left, appending,
>  					    &can_do_direct);
>  	if (ret < 0) {
> @@ -2251,12 +2251,12 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
>  				       unsigned int flags)
>  {
>  	int ret;
> -	struct inode *inode = out->f_path.dentry->d_inode;
> +	struct inode *inode = out->f_path_dentry->d_inode;
>  
>  	mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", out, pipe,
>  		   (unsigned int)len,
> -		   out->f_path.dentry->d_name.len,
> -		   out->f_path.dentry->d_name.name);
> +		   out->f_path_dentry->d_name.len,
> +		   out->f_path_dentry->d_name.name);
>  
>  	inode_double_lock(inode, pipe->inode);
>  
> @@ -2266,7 +2266,7 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
>  		goto out;
>  	}
>  
> -	ret = ocfs2_prepare_inode_for_write(out->f_path.dentry, ppos, len, 0,
> +	ret = ocfs2_prepare_inode_for_write(out->f_path_dentry, ppos, len, 0,
>  					    NULL);
>  	if (ret < 0) {
>  		mlog_errno(ret);
> @@ -2292,12 +2292,12 @@ static ssize_t ocfs2_file_splice_read(struct file *in,
>  				      unsigned int flags)
>  {
>  	int ret = 0;
> -	struct inode *inode = in->f_path.dentry->d_inode;
> +	struct inode *inode = in->f_path_dentry->d_inode;
>  
>  	mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", in, pipe,
>  		   (unsigned int)len,
> -		   in->f_path.dentry->d_name.len,
> -		   in->f_path.dentry->d_name.name);
> +		   in->f_path_dentry->d_name.len,
> +		   in->f_path_dentry->d_name.name);
>  
>  	/*
>  	 * See the comment in ocfs2_file_aio_read()
> @@ -2323,12 +2323,12 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
>  {
>  	int ret = 0, rw_level = -1, have_alloc_sem = 0, lock_level = 0;
>  	struct file *filp = iocb->ki_filp;
> -	struct inode *inode = filp->f_path.dentry->d_inode;
> +	struct inode *inode = filp->f_path_dentry->d_inode;
>  
>  	mlog_entry("(0x%p, %u, '%.*s')\n", filp,
>  		   (unsigned int)nr_segs,
> -		   filp->f_path.dentry->d_name.len,
> -		   filp->f_path.dentry->d_name.name);
> +		   filp->f_path_dentry->d_name.len,
> +		   filp->f_path_dentry->d_name.name);
>  
>  	if (!inode) {
>  		ret = -EINVAL;
> diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
> index 87dcece..929aeac 100644
> --- a/fs/ocfs2/ioctl.c
> +++ b/fs/ocfs2/ioctl.c
> @@ -148,7 +148,7 @@ int ocfs2_ioctl(struct inode * inode, struct file * filp,
>  #ifdef CONFIG_COMPAT
>  long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg)
>  {
> -	struct inode *inode = file->f_path.dentry->d_inode;
> +	struct inode *inode = file->f_path_dentry->d_inode;
>  	int ret;
>  
>  	switch (cmd) {
> diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c
> index 9875615..c0483c9 100644
> --- a/fs/ocfs2/mmap.c
> +++ b/fs/ocfs2/mmap.c
> @@ -152,7 +152,7 @@ out:
>  
>  static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page)
>  {
> -	struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
> +	struct inode *inode = vma->vm_file->f_path_dentry->d_inode;
>  	struct buffer_head *di_bh = NULL;
>  	sigset_t blocked, oldset;
>  	int ret, ret2;
> diff --git a/kapi-compat/include/fpath.h b/kapi-compat/include/fpath.h
> new file mode 100644
> index 0000000..178d8e3
> --- /dev/null
> +++ b/kapi-compat/include/fpath.h
> @@ -0,0 +1,10 @@
> +#ifndef KAPI_FPATH_H
> +#define KAPI_FPATH_H
> +
> +#ifdef HAS_F_PATH_DEFINED
> +# define f_path_dentry	f_path.dentry
> +#else
> +# define f_path_dentry	f_dentry
> +#endif
> +
> +#endif
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

Life's Little Instruction Book #3

	"Watch a sunrise at least once a year."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

  reply	other threads:[~2007-12-21  1:09 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 20/30] ocfs2: Handle splice.h Sunil Mushran
2007-12-21 15:12   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 07/30] ocfs2: Handle struct f_path in struct file Sunil Mushran
2007-12-21  1:09   ` Joel Becker [this message]
2007-12-21  9:41     ` Sunil Mushran
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 30/30] ocfs2: Handle missing exportfs.h Sunil Mushran
2007-12-24 13:32   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 09/30] ocfs2: Add helper inc_nlink Sunil Mushran
2007-12-21 11:39   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 06/30] ocfs2: Include do_sync_mapping_range() from mainline Sunil Mushran
2007-12-21  0:54   ` Joel Becker
2007-12-21  9:39     ` Sunil Mushran
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 04/30] ocfs2: Handle macro uninitialized_var Sunil Mushran
2007-12-21  0:56   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 29/30] ocfs2: Handle older prototype of bi_end_io_t Sunil Mushran
2007-12-24 13:30   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 23/30] ocfs2: Handle missing export generic_segment_checks() Sunil Mushran
2007-12-22  3:51   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 17/30] ocfs2: Handle the removal of struct subsystem Sunil Mushran
2007-12-21 15:10   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 22/30] ocfs2: Handles missing export should_remove_suid() Sunil Mushran
2007-12-22  3:51   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 15/30] ocfs2: Handle different prototypes of register_sysctl_table() Sunil Mushran
2007-12-21 11:59   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 24/30] ocfs2: Handle missing vmops->fault() Sunil Mushran
2007-12-24 13:21   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 28/30] ocfs2: Handle missing __splice_from_pipe() Sunil Mushran
2007-12-24 13:30   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 18/30] ocfs2: Handle missing macro is_owner_or_cap() Sunil Mushran
2007-12-21 15:10   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 11/30] ocfs2: Handle missing dtors in kmem_cache_create() Sunil Mushran
2007-12-21 11:47   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 05/30] ocfs2: Handle macro zero_user_page() Sunil Mushran
2007-12-21  0:56   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 26/30] ocfs2: Handle missing const struct inode_operations in struct inode Sunil Mushran
2007-12-24 13:23   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 13/30] ocfs2: Handle enum value FS_OCFS2 Sunil Mushran
2007-12-21 11:57   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 14/30] ocfs2: Handles configfs_depend_item() and configfs_undepend_item() Sunil Mushran
2007-12-21 11:57   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 08/30] ocfs2: Define enum umh_wait Sunil Mushran
2007-12-21 11:37   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 03/30] ocfs2: Handle workqueue changes Sunil Mushran
2007-12-21  0:54   ` Joel Becker
2007-12-21 11:51     ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 25/30] ocfs2: Handle missing const s_op in struct super_block Sunil Mushran
2007-12-24 13:23   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 10/30] ocfs2: Add helper drop_nlink Sunil Mushran
2007-12-21 11:39   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 19/30] ocfs2: Handle missing iop->fallocate() Sunil Mushran
2007-12-21 15:12   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 21/30] ocfs2: Handle missing macro MNT_RELATIME Sunil Mushran
2007-12-21 15:14   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 27/30] ocfs2: Handle missing vectorized fileops aio_read() and aio_write() Sunil Mushran
2007-12-24 13:28   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 16/30] ocfs2: Handle su_mutex in struct configfs_subsystem Sunil Mushran
2007-12-21 12:00   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 12/30] ocfs2: Define FS_RENAME_DOES_D_MOVE Sunil Mushran
2007-12-21 11:55   ` Joel Becker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071221090915.GF18627@ca-server1.us.oracle.com \
    --to=joel.becker@oracle.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.