Re: [f2fs-dev] [PATCH] mkfs.f2fs: fix sparse_mode case on stat

2024-02-19 Thread Chao Yu

On 2024/2/14 7:41, Jaegeuk Kim wrote:

When we turn on sparse_mode, stat() will be failed, as the file will be
created afterwards. Let's fix.

Fixes: 14197d546b93 ("f2fs-tools: fix to check loop device")
Signed-off-by: Jaegeuk Kim 


Reviewed-by: Chao Yu 

Thanks,


___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH] mkfs.f2fs: fix sparse_mode case on stat

2024-02-13 Thread Daeho Jeong
Reviewed-by: Daeho Jeong 

On Tue, Feb 13, 2024 at 3:42 PM Jaegeuk Kim  wrote:
>
> When we turn on sparse_mode, stat() will be failed, as the file will be
> created afterwards. Let's fix.
>
> Fixes: 14197d546b93 ("f2fs-tools: fix to check loop device")
> Signed-off-by: Jaegeuk Kim 
> ---
>  lib/libf2fs.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lib/libf2fs.c b/lib/libf2fs.c
> index 5c6c5b7bf8a7..d51e485361ee 100644
> --- a/lib/libf2fs.c
> +++ b/lib/libf2fs.c
> @@ -814,6 +814,9 @@ int f2fs_dev_is_umounted(char *path)
>  * the file system. In this case, we should not format.
>  */
> if (stat(path, _buf)) {
> +   /* sparse file will be created after this. */
> +   if (c.sparse_mode)
> +   return 0;
> MSG(0, "Info: stat failed errno:%d\n", errno);
> return -1;
> }
> --
> 2.43.0.687.g38aa6559b0-goog
>
>
>
> ___
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH] mkfs.f2fs: fix sparse_mode case on stat

2024-02-13 Thread Jaegeuk Kim
When we turn on sparse_mode, stat() will be failed, as the file will be
created afterwards. Let's fix.

Fixes: 14197d546b93 ("f2fs-tools: fix to check loop device")
Signed-off-by: Jaegeuk Kim 
---
 lib/libf2fs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/libf2fs.c b/lib/libf2fs.c
index 5c6c5b7bf8a7..d51e485361ee 100644
--- a/lib/libf2fs.c
+++ b/lib/libf2fs.c
@@ -814,6 +814,9 @@ int f2fs_dev_is_umounted(char *path)
 * the file system. In this case, we should not format.
 */
if (stat(path, _buf)) {
+   /* sparse file will be created after this. */
+   if (c.sparse_mode)
+   return 0;
MSG(0, "Info: stat failed errno:%d\n", errno);
return -1;
}
-- 
2.43.0.687.g38aa6559b0-goog



___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel