linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: export pin_file flag to user
@ 2019-01-04  4:19 Jaegeuk Kim
  2019-01-04  9:00 ` [f2fs-dev] " Chao Yu
  2019-01-04 20:44 ` [PATCH v2] f2fs: export FS_NOCOW_FL " Jaegeuk Kim
  0 siblings, 2 replies; 5+ messages in thread
From: Jaegeuk Kim @ 2019-01-04  4:19 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim

This exports pin_file status to user.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/f2fs.h | 3 ++-
 fs/f2fs/file.c | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 12fabd6735dd..036fd62010c1 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -2303,9 +2303,10 @@ static inline void f2fs_change_bit(unsigned int nr, char *addr)
 #define F2FS_EOFBLOCKS_FL		0x00400000 /* Blocks allocated beyond EOF */
 #define F2FS_INLINE_DATA_FL		0x10000000 /* Inode has inline data. */
 #define F2FS_PROJINHERIT_FL		0x20000000 /* Create with parents projid */
+#define F2FS_PIN_FILE_FL		0x40000000 /* pin_file status */
 #define F2FS_RESERVED_FL		0x80000000 /* reserved for ext4 lib */
 
-#define F2FS_FL_USER_VISIBLE		0x304BDFFF /* User visible flags */
+#define F2FS_FL_USER_VISIBLE		0x704BDFFF /* User visible flags */
 #define F2FS_FL_USER_MODIFIABLE		0x204BC0FF /* User modifiable flags */
 
 /* Flags we can manipulate with through F2FS_IOC_FSSETXATTR */
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index ae2b45e75847..eb099f1ee937 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1651,6 +1651,8 @@ static int f2fs_ioc_getflags(struct file *filp, unsigned long arg)
 		flags |= F2FS_ENCRYPT_FL;
 	if (f2fs_has_inline_data(inode) || f2fs_has_inline_dentry(inode))
 		flags |= F2FS_INLINE_DATA_FL;
+	if (is_inode_flag_set(inode, FI_PIN_FILE))
+		flags |= F2FS_PIN_FILE_FL;
 
 	flags &= F2FS_FL_USER_VISIBLE;
 
-- 
2.19.0.605.g01d371f741-goog


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

* Re: [f2fs-dev] [PATCH] f2fs: export pin_file flag to user
  2019-01-04  4:19 [PATCH] f2fs: export pin_file flag to user Jaegeuk Kim
@ 2019-01-04  9:00 ` Chao Yu
  2019-01-04 20:33   ` Jaegeuk Kim
  2019-01-04 20:44 ` [PATCH v2] f2fs: export FS_NOCOW_FL " Jaegeuk Kim
  1 sibling, 1 reply; 5+ messages in thread
From: Chao Yu @ 2019-01-04  9:00 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel

On 2019/1/4 12:19, Jaegeuk Kim wrote:
> This exports pin_file status to user.

Semantics of pin_file flag is the same as nocow flag which is more widely
used in lsattr/chattr and vfs now.

#define FS_NOCOW_FL                     0x00800000 /* Do not cow file */

lsattr/chattr
no copy on write (C)

How about exporting it via F2FS_NOCOW_FL(0x00800000)?

Thanks,

> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>  fs/f2fs/f2fs.h | 3 ++-
>  fs/f2fs/file.c | 2 ++
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 12fabd6735dd..036fd62010c1 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -2303,9 +2303,10 @@ static inline void f2fs_change_bit(unsigned int nr, char *addr)
>  #define F2FS_EOFBLOCKS_FL		0x00400000 /* Blocks allocated beyond EOF */
>  #define F2FS_INLINE_DATA_FL		0x10000000 /* Inode has inline data. */
>  #define F2FS_PROJINHERIT_FL		0x20000000 /* Create with parents projid */
> +#define F2FS_PIN_FILE_FL		0x40000000 /* pin_file status */
>  #define F2FS_RESERVED_FL		0x80000000 /* reserved for ext4 lib */
>  
> -#define F2FS_FL_USER_VISIBLE		0x304BDFFF /* User visible flags */
> +#define F2FS_FL_USER_VISIBLE		0x704BDFFF /* User visible flags */
>  #define F2FS_FL_USER_MODIFIABLE		0x204BC0FF /* User modifiable flags */
>  
>  /* Flags we can manipulate with through F2FS_IOC_FSSETXATTR */
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index ae2b45e75847..eb099f1ee937 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -1651,6 +1651,8 @@ static int f2fs_ioc_getflags(struct file *filp, unsigned long arg)
>  		flags |= F2FS_ENCRYPT_FL;
>  	if (f2fs_has_inline_data(inode) || f2fs_has_inline_dentry(inode))
>  		flags |= F2FS_INLINE_DATA_FL;
> +	if (is_inode_flag_set(inode, FI_PIN_FILE))
> +		flags |= F2FS_PIN_FILE_FL;
>  
>  	flags &= F2FS_FL_USER_VISIBLE;
>  
> 


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

* Re: [f2fs-dev] [PATCH] f2fs: export pin_file flag to user
  2019-01-04  9:00 ` [f2fs-dev] " Chao Yu
@ 2019-01-04 20:33   ` Jaegeuk Kim
  0 siblings, 0 replies; 5+ messages in thread
From: Jaegeuk Kim @ 2019-01-04 20:33 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel

On 01/04, Chao Yu wrote:
> On 2019/1/4 12:19, Jaegeuk Kim wrote:
> > This exports pin_file status to user.
> 
> Semantics of pin_file flag is the same as nocow flag which is more widely
> used in lsattr/chattr and vfs now.
> 
> #define FS_NOCOW_FL                     0x00800000 /* Do not cow file */
> 
> lsattr/chattr
> no copy on write (C)
> 
> How about exporting it via F2FS_NOCOW_FL(0x00800000)?

Yeah, let me send v2.

> 
> Thanks,
> 
> > 
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >  fs/f2fs/f2fs.h | 3 ++-
> >  fs/f2fs/file.c | 2 ++
> >  2 files changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> > index 12fabd6735dd..036fd62010c1 100644
> > --- a/fs/f2fs/f2fs.h
> > +++ b/fs/f2fs/f2fs.h
> > @@ -2303,9 +2303,10 @@ static inline void f2fs_change_bit(unsigned int nr, char *addr)
> >  #define F2FS_EOFBLOCKS_FL		0x00400000 /* Blocks allocated beyond EOF */
> >  #define F2FS_INLINE_DATA_FL		0x10000000 /* Inode has inline data. */
> >  #define F2FS_PROJINHERIT_FL		0x20000000 /* Create with parents projid */
> > +#define F2FS_PIN_FILE_FL		0x40000000 /* pin_file status */
> >  #define F2FS_RESERVED_FL		0x80000000 /* reserved for ext4 lib */
> >  
> > -#define F2FS_FL_USER_VISIBLE		0x304BDFFF /* User visible flags */
> > +#define F2FS_FL_USER_VISIBLE		0x704BDFFF /* User visible flags */
> >  #define F2FS_FL_USER_MODIFIABLE		0x204BC0FF /* User modifiable flags */
> >  
> >  /* Flags we can manipulate with through F2FS_IOC_FSSETXATTR */
> > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> > index ae2b45e75847..eb099f1ee937 100644
> > --- a/fs/f2fs/file.c
> > +++ b/fs/f2fs/file.c
> > @@ -1651,6 +1651,8 @@ static int f2fs_ioc_getflags(struct file *filp, unsigned long arg)
> >  		flags |= F2FS_ENCRYPT_FL;
> >  	if (f2fs_has_inline_data(inode) || f2fs_has_inline_dentry(inode))
> >  		flags |= F2FS_INLINE_DATA_FL;
> > +	if (is_inode_flag_set(inode, FI_PIN_FILE))
> > +		flags |= F2FS_PIN_FILE_FL;
> >  
> >  	flags &= F2FS_FL_USER_VISIBLE;
> >  
> > 

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

* Re: [PATCH v2] f2fs: export FS_NOCOW_FL flag to user
  2019-01-04  4:19 [PATCH] f2fs: export pin_file flag to user Jaegeuk Kim
  2019-01-04  9:00 ` [f2fs-dev] " Chao Yu
@ 2019-01-04 20:44 ` Jaegeuk Kim
  2019-01-07  1:39   ` [f2fs-dev] " Chao Yu
  1 sibling, 1 reply; 5+ messages in thread
From: Jaegeuk Kim @ 2019-01-04 20:44 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel

This exports pin_file status to user.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
v2:
 - use F2FS_NOCOW_FL (aka FS_NOCOW_FL)

 fs/f2fs/f2fs.h | 3 ++-
 fs/f2fs/file.c | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 12fabd6735dd..9286ec381453 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -2301,11 +2301,12 @@ static inline void f2fs_change_bit(unsigned int nr, char *addr)
 #define F2FS_EXTENTS_FL			0x00080000 /* Inode uses extents */
 #define F2FS_EA_INODE_FL	        0x00200000 /* Inode used for large EA */
 #define F2FS_EOFBLOCKS_FL		0x00400000 /* Blocks allocated beyond EOF */
+#define F2FS_NOCOW_FL			0x00800000 /* Do not cow file */
 #define F2FS_INLINE_DATA_FL		0x10000000 /* Inode has inline data. */
 #define F2FS_PROJINHERIT_FL		0x20000000 /* Create with parents projid */
 #define F2FS_RESERVED_FL		0x80000000 /* reserved for ext4 lib */
 
-#define F2FS_FL_USER_VISIBLE		0x304BDFFF /* User visible flags */
+#define F2FS_FL_USER_VISIBLE		0x30CBDFFF /* User visible flags */
 #define F2FS_FL_USER_MODIFIABLE		0x204BC0FF /* User modifiable flags */
 
 /* Flags we can manipulate with through F2FS_IOC_FSSETXATTR */
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index ae2b45e75847..0d461321edfc 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1651,6 +1651,8 @@ static int f2fs_ioc_getflags(struct file *filp, unsigned long arg)
 		flags |= F2FS_ENCRYPT_FL;
 	if (f2fs_has_inline_data(inode) || f2fs_has_inline_dentry(inode))
 		flags |= F2FS_INLINE_DATA_FL;
+	if (is_inode_flag_set(inode, FI_PIN_FILE))
+		flags |= F2FS_NOCOW_FL;
 
 	flags &= F2FS_FL_USER_VISIBLE;
 
-- 
2.19.0.605.g01d371f741-goog


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

* Re: [f2fs-dev] [PATCH v2] f2fs: export FS_NOCOW_FL flag to user
  2019-01-04 20:44 ` [PATCH v2] f2fs: export FS_NOCOW_FL " Jaegeuk Kim
@ 2019-01-07  1:39   ` Chao Yu
  0 siblings, 0 replies; 5+ messages in thread
From: Chao Yu @ 2019-01-07  1:39 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel

On 2019/1/5 4:44, Jaegeuk Kim wrote:
> This exports pin_file status to user.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,


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

end of thread, other threads:[~2019-01-07  1:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-04  4:19 [PATCH] f2fs: export pin_file flag to user Jaegeuk Kim
2019-01-04  9:00 ` [f2fs-dev] " Chao Yu
2019-01-04 20:33   ` Jaegeuk Kim
2019-01-04 20:44 ` [PATCH v2] f2fs: export FS_NOCOW_FL " Jaegeuk Kim
2019-01-07  1:39   ` [f2fs-dev] " Chao Yu

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