linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] erofs: add "noinline_data" extended option
@ 2021-07-04 13:33 Gao Xiang
  2021-07-04 16:18 ` 胡玮文
  0 siblings, 1 reply; 3+ messages in thread
From: Gao Xiang @ 2021-07-04 13:33 UTC (permalink / raw)
  To: linux-erofs; +Cc: Gao Xiang

In order to add preliminary DAX feature support.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 include/erofs/config.h | 1 +
 lib/inode.c            | 5 +++++
 mkfs/main.c            | 6 ++++++
 3 files changed, 12 insertions(+)

diff --git a/include/erofs/config.h b/include/erofs/config.h
index 67e7a0fed24c..8124f3b36baf 100644
--- a/include/erofs/config.h
+++ b/include/erofs/config.h
@@ -44,6 +44,7 @@ struct erofs_configure {
 	bool c_random_pclusterblks;
 #endif
 	char c_timeinherit;
+	bool c_noinline_data;
 
 #ifdef HAVE_LIBSELINUX
 	struct selabel_handle *sehnd;
diff --git a/lib/inode.c b/lib/inode.c
index 97f0cf763baf..38906370f533 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -562,6 +562,11 @@ static int erofs_prepare_inode_buffer(struct erofs_inode *inode)
 	if (is_inode_layout_compression(inode))
 		goto noinline;
 
+	if (cfg.c_noinline_data && S_ISREG(inode->i_mode)) {
+		inode->datalayout = EROFS_INODE_FLAT_PLAIN;
+		goto noinline;
+	}
+
 	/*
 	 * if the file size is block-aligned for uncompressed files,
 	 * should use EROFS_INODE_FLAT_PLAIN data mapping mode.
diff --git a/mkfs/main.c b/mkfs/main.c
index 28539da5ea5f..10fe14d7a722 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -161,6 +161,12 @@ static int parse_extended_opts(const char *opts)
 				return -EINVAL;
 			erofs_sb_clear_sb_chksum();
 		}
+
+		if (MATCH_EXTENTED_OPT("noinline_data", token, keylen)) {
+			if (vallen)
+				return -EINVAL;
+			cfg.c_noinline_data = true;
+		}
 	}
 	return 0;
 }
-- 
2.24.4


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

* Re: [PATCH] erofs: add "noinline_data" extended option
  2021-07-04 13:33 [PATCH] erofs: add "noinline_data" extended option Gao Xiang
@ 2021-07-04 16:18 ` 胡玮文
  2021-07-04 16:44   ` Gao Xiang
  0 siblings, 1 reply; 3+ messages in thread
From: 胡玮文 @ 2021-07-04 16:18 UTC (permalink / raw)
  To: Gao Xiang; +Cc: linux-erofs

Should the commit message starts with “erofs-utils:” instead of “erofs:”?

> 在 2021年7月4日,21:41,Gao Xiang <hsiangkao@linux.alibaba.com> 写道:
> 
> In order to add preliminary DAX feature support.
> 
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> ---
> include/erofs/config.h | 1 +
> lib/inode.c            | 5 +++++
> mkfs/main.c            | 6 ++++++
> 3 files changed, 12 insertions(+)
> 
> diff --git a/include/erofs/config.h b/include/erofs/config.h
> index 67e7a0fed24c..8124f3b36baf 100644
> --- a/include/erofs/config.h
> +++ b/include/erofs/config.h
> @@ -44,6 +44,7 @@ struct erofs_configure {
>    bool c_random_pclusterblks;
> #endif
>    char c_timeinherit;
> +    bool c_noinline_data;
> 
> #ifdef HAVE_LIBSELINUX
>    struct selabel_handle *sehnd;
> diff --git a/lib/inode.c b/lib/inode.c
> index 97f0cf763baf..38906370f533 100644
> --- a/lib/inode.c
> +++ b/lib/inode.c
> @@ -562,6 +562,11 @@ static int erofs_prepare_inode_buffer(struct erofs_inode *inode)
>    if (is_inode_layout_compression(inode))
>        goto noinline;
> 
> +    if (cfg.c_noinline_data && S_ISREG(inode->i_mode)) {
> +        inode->datalayout = EROFS_INODE_FLAT_PLAIN;
> +        goto noinline;
> +    }
> +
>    /*
>     * if the file size is block-aligned for uncompressed files,
>     * should use EROFS_INODE_FLAT_PLAIN data mapping mode.
> diff --git a/mkfs/main.c b/mkfs/main.c
> index 28539da5ea5f..10fe14d7a722 100644
> --- a/mkfs/main.c
> +++ b/mkfs/main.c
> @@ -161,6 +161,12 @@ static int parse_extended_opts(const char *opts)
>                return -EINVAL;
>            erofs_sb_clear_sb_chksum();
>        }
> +
> +        if (MATCH_EXTENTED_OPT("noinline_data", token, keylen)) {
> +            if (vallen)
> +                return -EINVAL;
> +            cfg.c_noinline_data = true;
> +        }
>    }
>    return 0;
> }
> -- 
> 2.24.4


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

* Re: [PATCH] erofs: add "noinline_data" extended option
  2021-07-04 16:18 ` 胡玮文
@ 2021-07-04 16:44   ` Gao Xiang
  0 siblings, 0 replies; 3+ messages in thread
From: Gao Xiang @ 2021-07-04 16:44 UTC (permalink / raw)
  To: 胡玮文; +Cc: linux-erofs

On Mon, Jul 05, 2021 at 12:18:38AM +0800, 胡玮文 wrote:
> Should the commit message starts with “erofs-utils:” instead of “erofs:”?

Hi Weiwen,
yeah, you are right, let me revise it in the morning...

Thanks,
Gao Xiang

> 
> > 在 2021年7月4日,21:41,Gao Xiang <hsiangkao@linux.alibaba.com> 写道:
> > 
> > In order to add preliminary DAX feature support.
> > 
> > Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> > ---
> > include/erofs/config.h | 1 +
> > lib/inode.c            | 5 +++++
> > mkfs/main.c            | 6 ++++++
> > 3 files changed, 12 insertions(+)
> > 
> > diff --git a/include/erofs/config.h b/include/erofs/config.h
> > index 67e7a0fed24c..8124f3b36baf 100644
> > --- a/include/erofs/config.h
> > +++ b/include/erofs/config.h
> > @@ -44,6 +44,7 @@ struct erofs_configure {
> >    bool c_random_pclusterblks;
> > #endif
> >    char c_timeinherit;
> > +    bool c_noinline_data;
> > 
> > #ifdef HAVE_LIBSELINUX
> >    struct selabel_handle *sehnd;
> > diff --git a/lib/inode.c b/lib/inode.c
> > index 97f0cf763baf..38906370f533 100644
> > --- a/lib/inode.c
> > +++ b/lib/inode.c
> > @@ -562,6 +562,11 @@ static int erofs_prepare_inode_buffer(struct erofs_inode *inode)
> >    if (is_inode_layout_compression(inode))
> >        goto noinline;
> > 
> > +    if (cfg.c_noinline_data && S_ISREG(inode->i_mode)) {
> > +        inode->datalayout = EROFS_INODE_FLAT_PLAIN;
> > +        goto noinline;
> > +    }
> > +
> >    /*
> >     * if the file size is block-aligned for uncompressed files,
> >     * should use EROFS_INODE_FLAT_PLAIN data mapping mode.
> > diff --git a/mkfs/main.c b/mkfs/main.c
> > index 28539da5ea5f..10fe14d7a722 100644
> > --- a/mkfs/main.c
> > +++ b/mkfs/main.c
> > @@ -161,6 +161,12 @@ static int parse_extended_opts(const char *opts)
> >                return -EINVAL;
> >            erofs_sb_clear_sb_chksum();
> >        }
> > +
> > +        if (MATCH_EXTENTED_OPT("noinline_data", token, keylen)) {
> > +            if (vallen)
> > +                return -EINVAL;
> > +            cfg.c_noinline_data = true;
> > +        }
> >    }
> >    return 0;
> > }
> > -- 
> > 2.24.4

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

end of thread, other threads:[~2021-07-04 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-04 13:33 [PATCH] erofs: add "noinline_data" extended option Gao Xiang
2021-07-04 16:18 ` 胡玮文
2021-07-04 16:44   ` Gao Xiang

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).