Cluster-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH] gfs2: cleanup file_operations mess
@ 2009-04-07 17:42 Christoph Hellwig
  2009-04-08  9:50 ` [Cluster-devel] " Steven Whitehouse
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2009-04-07 17:42 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Remove the weird pointer to file_operations mess and replace it with
straight-forward defining of the lockinginstance names to the _nolock
variants.


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/gfs2/inode.c
===================================================================
--- linux-2.6.orig/fs/gfs2/inode.c	2009-04-06 14:17:05.667570170 +0200
+++ linux-2.6/fs/gfs2/inode.c	2009-04-07 19:21:25.250572236 +0200
@@ -137,15 +137,15 @@ void gfs2_set_iop(struct inode *inode)
 	if (S_ISREG(mode)) {
 		inode->i_op = &gfs2_file_iops;
 		if (gfs2_localflocks(sdp))
-			inode->i_fop = gfs2_file_fops_nolock;
+			inode->i_fop = &gfs2_file_fops_nolock;
 		else
-			inode->i_fop = gfs2_file_fops;
+			inode->i_fop = &gfs2_file_fops;
 	} else if (S_ISDIR(mode)) {
 		inode->i_op = &gfs2_dir_iops;
 		if (gfs2_localflocks(sdp))
-			inode->i_fop = gfs2_dir_fops_nolock;
+			inode->i_fop = &gfs2_dir_fops_nolock;
 		else
-			inode->i_fop = gfs2_dir_fops;
+			inode->i_fop = &gfs2_dir_fops;
 	} else if (S_ISLNK(mode)) {
 		inode->i_op = &gfs2_symlink_iops;
 	} else {
Index: linux-2.6/fs/gfs2/inode.h
===================================================================
--- linux-2.6.orig/fs/gfs2/inode.h	2009-04-06 14:17:05.671570051 +0200
+++ linux-2.6/fs/gfs2/inode.h	2009-04-07 19:21:08.357447364 +0200
@@ -101,21 +101,23 @@ void gfs2_dinode_print(const struct gfs2
 extern const struct inode_operations gfs2_file_iops;
 extern const struct inode_operations gfs2_dir_iops;
 extern const struct inode_operations gfs2_symlink_iops;
-extern const struct file_operations *gfs2_file_fops_nolock;
-extern const struct file_operations *gfs2_dir_fops_nolock;
+extern const struct file_operations gfs2_file_fops_nolock;
+extern const struct file_operations gfs2_dir_fops_nolock;
 
 extern void gfs2_set_inode_flags(struct inode *inode);
  
 #ifdef CONFIG_GFS2_FS_LOCKING_DLM
-extern const struct file_operations *gfs2_file_fops;
-extern const struct file_operations *gfs2_dir_fops;
+extern const struct file_operations gfs2_file_fops;
+extern const struct file_operations gfs2_dir_fops;
+
 static inline int gfs2_localflocks(const struct gfs2_sbd *sdp)
 {
 	return sdp->sd_args.ar_localflocks;
 }
 #else /* Single node only */
-#define gfs2_file_fops NULL
-#define gfs2_dir_fops NULL
+#define gfs2_file_fops gfs2_file_fops_nolock
+#define gfs2_dir_fops gfs2_dir_fops_nolock
+
 static inline int gfs2_localflocks(const struct gfs2_sbd *sdp)
 {
 	return 1;
Index: linux-2.6/fs/gfs2/ops_file.c
===================================================================
--- linux-2.6.orig/fs/gfs2/ops_file.c	2009-04-06 14:17:05.716570192 +0200
+++ linux-2.6/fs/gfs2/ops_file.c	2009-04-07 17:56:32.544445433 +0200
@@ -705,7 +705,7 @@ static int gfs2_flock(struct file *file,
 	}
 }
 
-const struct file_operations *gfs2_file_fops = &(const struct file_operations){
+const struct file_operations gfs2_file_fops = {
 	.llseek		= gfs2_llseek,
 	.read		= do_sync_read,
 	.aio_read	= generic_file_aio_read,
@@ -723,7 +723,7 @@ const struct file_operations *gfs2_file_
 	.setlease	= gfs2_setlease,
 };
 
-const struct file_operations *gfs2_dir_fops = &(const struct file_operations){
+const struct file_operations gfs2_dir_fops = {
 	.readdir	= gfs2_readdir,
 	.unlocked_ioctl	= gfs2_ioctl,
 	.open		= gfs2_open,
@@ -735,7 +735,7 @@ const struct file_operations *gfs2_dir_f
 
 #endif /* CONFIG_GFS2_FS_LOCKING_DLM */
 
-const struct file_operations *gfs2_file_fops_nolock = &(const struct file_operations){
+const struct file_operations gfs2_file_fops_nolock = {
 	.llseek		= gfs2_llseek,
 	.read		= do_sync_read,
 	.aio_read	= generic_file_aio_read,
@@ -751,7 +751,7 @@ const struct file_operations *gfs2_file_
 	.setlease	= generic_setlease,
 };
 
-const struct file_operations *gfs2_dir_fops_nolock = &(const struct file_operations){
+const struct file_operations gfs2_dir_fops_nolock = {
 	.readdir	= gfs2_readdir,
 	.unlocked_ioctl	= gfs2_ioctl,
 	.open		= gfs2_open,



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Cluster-devel] Re: [PATCH] gfs2: cleanup file_operations mess
  2009-04-07 17:42 [Cluster-devel] [PATCH] gfs2: cleanup file_operations mess Christoph Hellwig
@ 2009-04-08  9:50 ` Steven Whitehouse
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Whitehouse @ 2009-04-08  9:50 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

Yes, that looks better! Its about to appear in the GFS2 git tree.
Thanks,

Steve.

On Tue, 2009-04-07 at 19:42 +0200, Christoph Hellwig wrote:
> Remove the weird pointer to file_operations mess and replace it with
> straight-forward defining of the lockinginstance names to the _nolock
> variants.
> 
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Index: linux-2.6/fs/gfs2/inode.c
> ===================================================================
> --- linux-2.6.orig/fs/gfs2/inode.c	2009-04-06 14:17:05.667570170 +0200
> +++ linux-2.6/fs/gfs2/inode.c	2009-04-07 19:21:25.250572236 +0200
> @@ -137,15 +137,15 @@ void gfs2_set_iop(struct inode *inode)
>  	if (S_ISREG(mode)) {
>  		inode->i_op = &gfs2_file_iops;
>  		if (gfs2_localflocks(sdp))
> -			inode->i_fop = gfs2_file_fops_nolock;
> +			inode->i_fop = &gfs2_file_fops_nolock;
>  		else
> -			inode->i_fop = gfs2_file_fops;
> +			inode->i_fop = &gfs2_file_fops;
>  	} else if (S_ISDIR(mode)) {
>  		inode->i_op = &gfs2_dir_iops;
>  		if (gfs2_localflocks(sdp))
> -			inode->i_fop = gfs2_dir_fops_nolock;
> +			inode->i_fop = &gfs2_dir_fops_nolock;
>  		else
> -			inode->i_fop = gfs2_dir_fops;
> +			inode->i_fop = &gfs2_dir_fops;
>  	} else if (S_ISLNK(mode)) {
>  		inode->i_op = &gfs2_symlink_iops;
>  	} else {
> Index: linux-2.6/fs/gfs2/inode.h
> ===================================================================
> --- linux-2.6.orig/fs/gfs2/inode.h	2009-04-06 14:17:05.671570051 +0200
> +++ linux-2.6/fs/gfs2/inode.h	2009-04-07 19:21:08.357447364 +0200
> @@ -101,21 +101,23 @@ void gfs2_dinode_print(const struct gfs2
>  extern const struct inode_operations gfs2_file_iops;
>  extern const struct inode_operations gfs2_dir_iops;
>  extern const struct inode_operations gfs2_symlink_iops;
> -extern const struct file_operations *gfs2_file_fops_nolock;
> -extern const struct file_operations *gfs2_dir_fops_nolock;
> +extern const struct file_operations gfs2_file_fops_nolock;
> +extern const struct file_operations gfs2_dir_fops_nolock;
>  
>  extern void gfs2_set_inode_flags(struct inode *inode);
>   
>  #ifdef CONFIG_GFS2_FS_LOCKING_DLM
> -extern const struct file_operations *gfs2_file_fops;
> -extern const struct file_operations *gfs2_dir_fops;
> +extern const struct file_operations gfs2_file_fops;
> +extern const struct file_operations gfs2_dir_fops;
> +
>  static inline int gfs2_localflocks(const struct gfs2_sbd *sdp)
>  {
>  	return sdp->sd_args.ar_localflocks;
>  }
>  #else /* Single node only */
> -#define gfs2_file_fops NULL
> -#define gfs2_dir_fops NULL
> +#define gfs2_file_fops gfs2_file_fops_nolock
> +#define gfs2_dir_fops gfs2_dir_fops_nolock
> +
>  static inline int gfs2_localflocks(const struct gfs2_sbd *sdp)
>  {
>  	return 1;
> Index: linux-2.6/fs/gfs2/ops_file.c
> ===================================================================
> --- linux-2.6.orig/fs/gfs2/ops_file.c	2009-04-06 14:17:05.716570192 +0200
> +++ linux-2.6/fs/gfs2/ops_file.c	2009-04-07 17:56:32.544445433 +0200
> @@ -705,7 +705,7 @@ static int gfs2_flock(struct file *file,
>  	}
>  }
>  
> -const struct file_operations *gfs2_file_fops = &(const struct file_operations){
> +const struct file_operations gfs2_file_fops = {
>  	.llseek		= gfs2_llseek,
>  	.read		= do_sync_read,
>  	.aio_read	= generic_file_aio_read,
> @@ -723,7 +723,7 @@ const struct file_operations *gfs2_file_
>  	.setlease	= gfs2_setlease,
>  };
>  
> -const struct file_operations *gfs2_dir_fops = &(const struct file_operations){
> +const struct file_operations gfs2_dir_fops = {
>  	.readdir	= gfs2_readdir,
>  	.unlocked_ioctl	= gfs2_ioctl,
>  	.open		= gfs2_open,
> @@ -735,7 +735,7 @@ const struct file_operations *gfs2_dir_f
>  
>  #endif /* CONFIG_GFS2_FS_LOCKING_DLM */
>  
> -const struct file_operations *gfs2_file_fops_nolock = &(const struct file_operations){
> +const struct file_operations gfs2_file_fops_nolock = {
>  	.llseek		= gfs2_llseek,
>  	.read		= do_sync_read,
>  	.aio_read	= generic_file_aio_read,
> @@ -751,7 +751,7 @@ const struct file_operations *gfs2_file_
>  	.setlease	= generic_setlease,
>  };
>  
> -const struct file_operations *gfs2_dir_fops_nolock = &(const struct file_operations){
> +const struct file_operations gfs2_dir_fops_nolock = {
>  	.readdir	= gfs2_readdir,
>  	.unlocked_ioctl	= gfs2_ioctl,
>  	.open		= gfs2_open,



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-04-08  9:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-07 17:42 [Cluster-devel] [PATCH] gfs2: cleanup file_operations mess Christoph Hellwig
2009-04-08  9:50 ` [Cluster-devel] " Steven Whitehouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox