linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] efs: fix the efs new mount api implementation
@ 2024-10-14 19:02 Bill O'Donnell
  2024-10-15 13:59 ` Christian Brauner
  2024-10-15 17:33 ` Eric Sandeen
  0 siblings, 2 replies; 3+ messages in thread
From: Bill O'Donnell @ 2024-10-14 19:02 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: brauner, sandeen, Bill O'Donnell

Commit 39a6c668e4 (efs: convert efs to use the new mount api)
did not include anything from v2 and v3 that were also submitted.
Fix this by bringing in those changes that were proposed in v2 and
v3.

Fixes: 39a6c668e4 efs: convert efs to use the new mount api.

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
---
 fs/efs/super.c | 43 +++----------------------------------------
 1 file changed, 3 insertions(+), 40 deletions(-)

diff --git a/fs/efs/super.c b/fs/efs/super.c
index e4421c10caeb..c59086b7eabf 100644
--- a/fs/efs/super.c
+++ b/fs/efs/super.c
@@ -15,7 +15,6 @@
 #include <linux/vfs.h>
 #include <linux/blkdev.h>
 #include <linux/fs_context.h>
-#include <linux/fs_parser.h>
 #include "efs.h"
 #include <linux/efs_vh.h>
 #include <linux/efs_fs_sb.h>
@@ -49,15 +48,6 @@ static struct pt_types sgi_pt_types[] = {
 	{0,		NULL}
 };
 
-enum {
-	Opt_explicit_open,
-};
-
-static const struct fs_parameter_spec efs_param_spec[] = {
-	fsparam_flag    ("explicit-open",       Opt_explicit_open),
-	{}
-};
-
 /*
  * File system definition and registration.
  */
@@ -67,7 +57,6 @@ static struct file_system_type efs_fs_type = {
 	.kill_sb		= efs_kill_sb,
 	.fs_flags		= FS_REQUIRES_DEV,
 	.init_fs_context	= efs_init_fs_context,
-	.parameters		= efs_param_spec,
 };
 MODULE_ALIAS_FS("efs");
 
@@ -265,7 +254,8 @@ static int efs_fill_super(struct super_block *s, struct fs_context *fc)
 	if (!sb_set_blocksize(s, EFS_BLOCKSIZE)) {
 		pr_err("device does not support %d byte blocks\n",
 			EFS_BLOCKSIZE);
-		return -EINVAL;
+		return invalf(fc, "device does not support %d byte blocks\n",
+			      EFS_BLOCKSIZE);
 	}
 
 	/* read the vh (volume header) block */
@@ -327,43 +317,22 @@ static int efs_fill_super(struct super_block *s, struct fs_context *fc)
 	return 0;
 }
 
-static void efs_free_fc(struct fs_context *fc)
-{
-	kfree(fc->fs_private);
-}
-
 static int efs_get_tree(struct fs_context *fc)
 {
 	return get_tree_bdev(fc, efs_fill_super);
 }
 
-static int efs_parse_param(struct fs_context *fc, struct fs_parameter *param)
-{
-	int token;
-	struct fs_parse_result result;
-
-	token = fs_parse(fc, efs_param_spec, param, &result);
-	if (token < 0)
-		return token;
-	return 0;
-}
-
 static int efs_reconfigure(struct fs_context *fc)
 {
 	sync_filesystem(fc->root->d_sb);
+	fc->sb_flags |= SB_RDONLY;
 
 	return 0;
 }
 
-struct efs_context {
-	unsigned long s_mount_opts;
-};
-
 static const struct fs_context_operations efs_context_opts = {
-	.parse_param	= efs_parse_param,
 	.get_tree	= efs_get_tree,
 	.reconfigure	= efs_reconfigure,
-	.free		= efs_free_fc,
 };
 
 /*
@@ -371,12 +340,6 @@ static const struct fs_context_operations efs_context_opts = {
  */
 static int efs_init_fs_context(struct fs_context *fc)
 {
-	struct efs_context *ctx;
-
-	ctx = kzalloc(sizeof(struct efs_context), GFP_KERNEL);
-	if (!ctx)
-		return -ENOMEM;
-	fc->fs_private = ctx;
 	fc->ops = &efs_context_opts;
 
 	return 0;
-- 
2.47.0


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

* Re: [PATCH] efs: fix the efs new mount api implementation
  2024-10-14 19:02 [PATCH] efs: fix the efs new mount api implementation Bill O'Donnell
@ 2024-10-15 13:59 ` Christian Brauner
  2024-10-15 17:33 ` Eric Sandeen
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2024-10-15 13:59 UTC (permalink / raw)
  To: linux-fsdevel, Bill O'Donnell; +Cc: Christian Brauner, sandeen

On Mon, 14 Oct 2024 14:02:41 -0500, Bill O'Donnell wrote:
> Commit 39a6c668e4 (efs: convert efs to use the new mount api)
> did not include anything from v2 and v3 that were also submitted.
> Fix this by bringing in those changes that were proposed in v2 and
> v3.
> 
> Fixes: 39a6c668e4 efs: convert efs to use the new mount api.
> 
> [...]

Applied to the vfs.mount.api branch of the vfs/vfs.git tree.
Patches in the vfs.mount.api branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.mount.api

[1/1] efs: fix the efs new mount api implementation
      https://git.kernel.org/vfs/vfs/c/51ceeb1a8142

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

* Re: [PATCH] efs: fix the efs new mount api implementation
  2024-10-14 19:02 [PATCH] efs: fix the efs new mount api implementation Bill O'Donnell
  2024-10-15 13:59 ` Christian Brauner
@ 2024-10-15 17:33 ` Eric Sandeen
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2024-10-15 17:33 UTC (permalink / raw)
  To: Bill O'Donnell, linux-fsdevel; +Cc: brauner, sandeen

On 10/14/24 2:02 PM, Bill O'Donnell wrote:
> Commit 39a6c668e4 (efs: convert efs to use the new mount api)
> did not include anything from v2 and v3 that were also submitted.
> Fix this by bringing in those changes that were proposed in v2 and
> v3.
> 
> Fixes: 39a6c668e4 efs: convert efs to use the new mount api.
> 
> Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>

Thanks Bill. 

I'd kind of like to see efs_context_opts renamed to efs_context_ops - this
is an ops vector, nothing to do with opts or "options."

But I hadn't caught that on the first review, and functionally this fixes
the in fill_super problems and removes the dead code, so:

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  fs/efs/super.c | 43 +++----------------------------------------
>  1 file changed, 3 insertions(+), 40 deletions(-)
> 
> diff --git a/fs/efs/super.c b/fs/efs/super.c
> index e4421c10caeb..c59086b7eabf 100644
> --- a/fs/efs/super.c
> +++ b/fs/efs/super.c
> @@ -15,7 +15,6 @@
>  #include <linux/vfs.h>
>  #include <linux/blkdev.h>
>  #include <linux/fs_context.h>
> -#include <linux/fs_parser.h>
>  #include "efs.h"
>  #include <linux/efs_vh.h>
>  #include <linux/efs_fs_sb.h>
> @@ -49,15 +48,6 @@ static struct pt_types sgi_pt_types[] = {
>  	{0,		NULL}
>  };
>  
> -enum {
> -	Opt_explicit_open,
> -};
> -
> -static const struct fs_parameter_spec efs_param_spec[] = {
> -	fsparam_flag    ("explicit-open",       Opt_explicit_open),
> -	{}
> -};
> -
>  /*
>   * File system definition and registration.
>   */
> @@ -67,7 +57,6 @@ static struct file_system_type efs_fs_type = {
>  	.kill_sb		= efs_kill_sb,
>  	.fs_flags		= FS_REQUIRES_DEV,
>  	.init_fs_context	= efs_init_fs_context,
> -	.parameters		= efs_param_spec,
>  };
>  MODULE_ALIAS_FS("efs");
>  
> @@ -265,7 +254,8 @@ static int efs_fill_super(struct super_block *s, struct fs_context *fc)
>  	if (!sb_set_blocksize(s, EFS_BLOCKSIZE)) {
>  		pr_err("device does not support %d byte blocks\n",
>  			EFS_BLOCKSIZE);
> -		return -EINVAL;
> +		return invalf(fc, "device does not support %d byte blocks\n",
> +			      EFS_BLOCKSIZE);
>  	}
>  
>  	/* read the vh (volume header) block */
> @@ -327,43 +317,22 @@ static int efs_fill_super(struct super_block *s, struct fs_context *fc)
>  	return 0;
>  }
>  
> -static void efs_free_fc(struct fs_context *fc)
> -{
> -	kfree(fc->fs_private);
> -}
> -
>  static int efs_get_tree(struct fs_context *fc)
>  {
>  	return get_tree_bdev(fc, efs_fill_super);
>  }
>  
> -static int efs_parse_param(struct fs_context *fc, struct fs_parameter *param)
> -{
> -	int token;
> -	struct fs_parse_result result;
> -
> -	token = fs_parse(fc, efs_param_spec, param, &result);
> -	if (token < 0)
> -		return token;
> -	return 0;
> -}
> -
>  static int efs_reconfigure(struct fs_context *fc)
>  {
>  	sync_filesystem(fc->root->d_sb);
> +	fc->sb_flags |= SB_RDONLY;
>  
>  	return 0;
>  }
>  
> -struct efs_context {
> -	unsigned long s_mount_opts;
> -};
> -
>  static const struct fs_context_operations efs_context_opts = {
> -	.parse_param	= efs_parse_param,
>  	.get_tree	= efs_get_tree,
>  	.reconfigure	= efs_reconfigure,
> -	.free		= efs_free_fc,
>  };
>  
>  /*
> @@ -371,12 +340,6 @@ static const struct fs_context_operations efs_context_opts = {
>   */
>  static int efs_init_fs_context(struct fs_context *fc)
>  {
> -	struct efs_context *ctx;
> -
> -	ctx = kzalloc(sizeof(struct efs_context), GFP_KERNEL);
> -	if (!ctx)
> -		return -ENOMEM;
> -	fc->fs_private = ctx;
>  	fc->ops = &efs_context_opts;
>  
>  	return 0;


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

end of thread, other threads:[~2024-10-15 17:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-14 19:02 [PATCH] efs: fix the efs new mount api implementation Bill O'Donnell
2024-10-15 13:59 ` Christian Brauner
2024-10-15 17:33 ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).