All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: delete unused is_vol_small() and BTRFS_MKFS_SMALL_VOLUME_SIZE
@ 2018-09-26  7:36 Anand Jain
  2018-09-26  7:38 ` Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Anand Jain @ 2018-09-26  7:36 UTC (permalink / raw)
  To: linux-btrfs

Since commit c11e36a29e84 (Btrfs-progs: Do not force mixed block group
creation unless '-M' option is specified) we don't have automatic
mixed mode, and the function is_vol_small() and the define
BTRFS_MKFS_SMALL_VOLUME_SIZE was obsolete since then so clean it up.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 mkfs/common.c | 29 -----------------------------
 mkfs/common.h |  1 -
 2 files changed, 30 deletions(-)

diff --git a/mkfs/common.c b/mkfs/common.c
index 0ace262b0e5f..c59e1d8eda4a 100644
--- a/mkfs/common.c
+++ b/mkfs/common.c
@@ -772,35 +772,6 @@ int test_status_for_mkfs(const char *file, bool force_overwrite)
 	return 0;
 }
 
-int is_vol_small(const char *file)
-{
-	int fd = -1;
-	int e;
-	struct stat st;
-	u64 size;
-
-	fd = open(file, O_RDONLY);
-	if (fd < 0)
-		return -errno;
-	if (fstat(fd, &st) < 0) {
-		e = -errno;
-		close(fd);
-		return e;
-	}
-	size = btrfs_device_size(fd, &st);
-	if (size == 0) {
-		close(fd);
-		return -1;
-	}
-	if (size < BTRFS_MKFS_SMALL_VOLUME_SIZE) {
-		close(fd);
-		return 1;
-	} else {
-		close(fd);
-		return 0;
-	}
-}
-
 int test_minimum_size(const char *file, u64 min_dev_size)
 {
 	int fd;
diff --git a/mkfs/common.h b/mkfs/common.h
index 28912906d0a9..18f5c3b66270 100644
--- a/mkfs/common.h
+++ b/mkfs/common.h
@@ -26,7 +26,6 @@
 #include "common-defs.h"
 
 #define BTRFS_MKFS_SYSTEM_GROUP_SIZE SZ_4M
-#define BTRFS_MKFS_SMALL_VOLUME_SIZE SZ_1G
 
 /*
  * Tree root blocks created during mkfs
-- 
1.8.3.1


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

* Re: [PATCH] btrfs-progs: delete unused is_vol_small() and BTRFS_MKFS_SMALL_VOLUME_SIZE
  2018-09-26  7:36 [PATCH] btrfs-progs: delete unused is_vol_small() and BTRFS_MKFS_SMALL_VOLUME_SIZE Anand Jain
@ 2018-09-26  7:38 ` Qu Wenruo
  2018-09-26  7:39 ` Qu Wenruo
  2018-09-26  7:44 ` [PATCH v2] " Anand Jain
  2 siblings, 0 replies; 6+ messages in thread
From: Qu Wenruo @ 2018-09-26  7:38 UTC (permalink / raw)
  To: Anand Jain, linux-btrfs


[-- Attachment #1.1: Type: text/plain, Size: 1767 bytes --]



On 2018/9/26 下午3:36, Anand Jain wrote:
> Since commit c11e36a29e84 (Btrfs-progs: Do not force mixed block group
> creation unless '-M' option is specified) we don't have automatic
> mixed mode, and the function is_vol_small() and the define
> BTRFS_MKFS_SMALL_VOLUME_SIZE was obsolete since then so clean it up.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>  mkfs/common.c | 29 -----------------------------
>  mkfs/common.h |  1 -
>  2 files changed, 30 deletions(-)
> 
> diff --git a/mkfs/common.c b/mkfs/common.c
> index 0ace262b0e5f..c59e1d8eda4a 100644
> --- a/mkfs/common.c
> +++ b/mkfs/common.c
> @@ -772,35 +772,6 @@ int test_status_for_mkfs(const char *file, bool force_overwrite)
>  	return 0;
>  }
>  
> -int is_vol_small(const char *file)
> -{
> -	int fd = -1;
> -	int e;
> -	struct stat st;
> -	u64 size;
> -
> -	fd = open(file, O_RDONLY);
> -	if (fd < 0)
> -		return -errno;
> -	if (fstat(fd, &st) < 0) {
> -		e = -errno;
> -		close(fd);
> -		return e;
> -	}
> -	size = btrfs_device_size(fd, &st);
> -	if (size == 0) {
> -		close(fd);
> -		return -1;
> -	}
> -	if (size < BTRFS_MKFS_SMALL_VOLUME_SIZE) {
> -		close(fd);
> -		return 1;
> -	} else {
> -		close(fd);
> -		return 0;
> -	}
> -}
> -
>  int test_minimum_size(const char *file, u64 min_dev_size)
>  {
>  	int fd;
> diff --git a/mkfs/common.h b/mkfs/common.h
> index 28912906d0a9..18f5c3b66270 100644
> --- a/mkfs/common.h
> +++ b/mkfs/common.h
> @@ -26,7 +26,6 @@
>  #include "common-defs.h"
>  
>  #define BTRFS_MKFS_SYSTEM_GROUP_SIZE SZ_4M
> -#define BTRFS_MKFS_SMALL_VOLUME_SIZE SZ_1G
>  
>  /*
>   * Tree root blocks created during mkfs
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] btrfs-progs: delete unused is_vol_small() and BTRFS_MKFS_SMALL_VOLUME_SIZE
  2018-09-26  7:36 [PATCH] btrfs-progs: delete unused is_vol_small() and BTRFS_MKFS_SMALL_VOLUME_SIZE Anand Jain
  2018-09-26  7:38 ` Qu Wenruo
@ 2018-09-26  7:39 ` Qu Wenruo
  2018-09-26  7:42   ` Anand Jain
  2018-09-26  7:44 ` [PATCH v2] " Anand Jain
  2 siblings, 1 reply; 6+ messages in thread
From: Qu Wenruo @ 2018-09-26  7:39 UTC (permalink / raw)
  To: Anand Jain, linux-btrfs


[-- Attachment #1.1: Type: text/plain, Size: 1864 bytes --]



On 2018/9/26 下午3:36, Anand Jain wrote:
> Since commit c11e36a29e84 (Btrfs-progs: Do not force mixed block group
> creation unless '-M' option is specified) we don't have automatic
> mixed mode, and the function is_vol_small() and the define
> BTRFS_MKFS_SMALL_VOLUME_SIZE was obsolete since then so clean it up.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  mkfs/common.c | 29 -----------------------------
>  mkfs/common.h |  1 -
>  2 files changed, 30 deletions(-)
> 
> diff --git a/mkfs/common.c b/mkfs/common.c
> index 0ace262b0e5f..c59e1d8eda4a 100644
> --- a/mkfs/common.c
> +++ b/mkfs/common.c
> @@ -772,35 +772,6 @@ int test_status_for_mkfs(const char *file, bool force_overwrite)
>  	return 0;
>  }
>  
> -int is_vol_small(const char *file)
> -{
> -	int fd = -1;
> -	int e;
> -	struct stat st;
> -	u64 size;
> -
> -	fd = open(file, O_RDONLY);
> -	if (fd < 0)
> -		return -errno;
> -	if (fstat(fd, &st) < 0) {
> -		e = -errno;
> -		close(fd);
> -		return e;
> -	}
> -	size = btrfs_device_size(fd, &st);
> -	if (size == 0) {
> -		close(fd);
> -		return -1;
> -	}
> -	if (size < BTRFS_MKFS_SMALL_VOLUME_SIZE) {
> -		close(fd);
> -		return 1;
> -	} else {
> -		close(fd);
> -		return 0;
> -	}
> -}
> -
>  int test_minimum_size(const char *file, u64 min_dev_size)
>  {
>  	int fd;
> diff --git a/mkfs/common.h b/mkfs/common.h
> index 28912906d0a9..18f5c3b66270 100644
> --- a/mkfs/common.h
> +++ b/mkfs/common.h
> @@ -26,7 +26,6 @@
>  #include "common-defs.h"
>  
>  #define BTRFS_MKFS_SYSTEM_GROUP_SIZE SZ_4M
> -#define BTRFS_MKFS_SMALL_VOLUME_SIZE SZ_1G

Wait for a minute, is_vol_small()'s declaration is not removed.

Did I miss something? Or it's already removed by some newer commit?

Thanks,
Qu

>  
>  /*
>   * Tree root blocks created during mkfs
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] btrfs-progs: delete unused is_vol_small() and BTRFS_MKFS_SMALL_VOLUME_SIZE
  2018-09-26  7:39 ` Qu Wenruo
@ 2018-09-26  7:42   ` Anand Jain
  0 siblings, 0 replies; 6+ messages in thread
From: Anand Jain @ 2018-09-26  7:42 UTC (permalink / raw)
  To: Qu Wenruo, linux-btrfs



On 09/26/2018 03:39 PM, Qu Wenruo wrote:
> 
> 
> On 2018/9/26 下午3:36, Anand Jain wrote:
>> Since commit c11e36a29e84 (Btrfs-progs: Do not force mixed block group
>> creation unless '-M' option is specified) we don't have automatic
>> mixed mode, and the function is_vol_small() and the define
>> BTRFS_MKFS_SMALL_VOLUME_SIZE was obsolete since then so clean it up.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>>   mkfs/common.c | 29 -----------------------------
>>   mkfs/common.h |  1 -
>>   2 files changed, 30 deletions(-)
>>
>> diff --git a/mkfs/common.c b/mkfs/common.c
>> index 0ace262b0e5f..c59e1d8eda4a 100644
>> --- a/mkfs/common.c
>> +++ b/mkfs/common.c
>> @@ -772,35 +772,6 @@ int test_status_for_mkfs(const char *file, bool force_overwrite)
>>   	return 0;
>>   }
>>   
>> -int is_vol_small(const char *file)
>> -{
>> -	int fd = -1;
>> -	int e;
>> -	struct stat st;
>> -	u64 size;
>> -
>> -	fd = open(file, O_RDONLY);
>> -	if (fd < 0)
>> -		return -errno;
>> -	if (fstat(fd, &st) < 0) {
>> -		e = -errno;
>> -		close(fd);
>> -		return e;
>> -	}
>> -	size = btrfs_device_size(fd, &st);
>> -	if (size == 0) {
>> -		close(fd);
>> -		return -1;
>> -	}
>> -	if (size < BTRFS_MKFS_SMALL_VOLUME_SIZE) {
>> -		close(fd);
>> -		return 1;
>> -	} else {
>> -		close(fd);
>> -		return 0;
>> -	}
>> -}
>> -
>>   int test_minimum_size(const char *file, u64 min_dev_size)
>>   {
>>   	int fd;
>> diff --git a/mkfs/common.h b/mkfs/common.h
>> index 28912906d0a9..18f5c3b66270 100644
>> --- a/mkfs/common.h
>> +++ b/mkfs/common.h
>> @@ -26,7 +26,6 @@
>>   #include "common-defs.h"
>>   
>>   #define BTRFS_MKFS_SYSTEM_GROUP_SIZE SZ_4M
>> -#define BTRFS_MKFS_SMALL_VOLUME_SIZE SZ_1G
> 
> Wait for a minute, is_vol_small()'s declaration is not removed.
> 
> Did I miss something? Or it's already removed by some newer commit?

  You caught me ;-). Its still there will fix in v2.

Thanks, Anand

> Thanks,
> Qu
> 
>>   
>>   /*
>>    * Tree root blocks created during mkfs
>>
> 

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

* [PATCH v2] btrfs-progs: delete unused is_vol_small() and BTRFS_MKFS_SMALL_VOLUME_SIZE
  2018-09-26  7:36 [PATCH] btrfs-progs: delete unused is_vol_small() and BTRFS_MKFS_SMALL_VOLUME_SIZE Anand Jain
  2018-09-26  7:38 ` Qu Wenruo
  2018-09-26  7:39 ` Qu Wenruo
@ 2018-09-26  7:44 ` Anand Jain
  2018-09-26  7:51   ` Qu Wenruo
  2 siblings, 1 reply; 6+ messages in thread
From: Anand Jain @ 2018-09-26  7:44 UTC (permalink / raw)
  To: linux-btrfs

Since commit c11e36a29e84 (Btrfs-progs: Do not force mixed block group
creation unless '-M' option is specified) we don't have automatic
mixed mode, and the function is_vol_small() and
the define BTRFS_MKFS_SMALL_VOLUME_SIZE become obsolete, so clean it up.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
v1->v2: drop is_vol_small() in mkfs/common.h
 mkfs/common.c | 29 -----------------------------
 mkfs/common.h |  2 --
 2 files changed, 31 deletions(-)

diff --git a/mkfs/common.c b/mkfs/common.c
index 0ace262b0e5f..c59e1d8eda4a 100644
--- a/mkfs/common.c
+++ b/mkfs/common.c
@@ -772,35 +772,6 @@ int test_status_for_mkfs(const char *file, bool force_overwrite)
 	return 0;
 }
 
-int is_vol_small(const char *file)
-{
-	int fd = -1;
-	int e;
-	struct stat st;
-	u64 size;
-
-	fd = open(file, O_RDONLY);
-	if (fd < 0)
-		return -errno;
-	if (fstat(fd, &st) < 0) {
-		e = -errno;
-		close(fd);
-		return e;
-	}
-	size = btrfs_device_size(fd, &st);
-	if (size == 0) {
-		close(fd);
-		return -1;
-	}
-	if (size < BTRFS_MKFS_SMALL_VOLUME_SIZE) {
-		close(fd);
-		return 1;
-	} else {
-		close(fd);
-		return 0;
-	}
-}
-
 int test_minimum_size(const char *file, u64 min_dev_size)
 {
 	int fd;
diff --git a/mkfs/common.h b/mkfs/common.h
index 28912906d0a9..b0ac3e35c6e9 100644
--- a/mkfs/common.h
+++ b/mkfs/common.h
@@ -26,7 +26,6 @@
 #include "common-defs.h"
 
 #define BTRFS_MKFS_SYSTEM_GROUP_SIZE SZ_4M
-#define BTRFS_MKFS_SMALL_VOLUME_SIZE SZ_1G
 
 /*
  * Tree root blocks created during mkfs
@@ -69,7 +68,6 @@ int make_btrfs(int fd, struct btrfs_mkfs_config *cfg);
 u64 btrfs_min_dev_size(u32 nodesize, int mixed, u64 meta_profile,
 		       u64 data_profile);
 int test_minimum_size(const char *file, u64 min_dev_size);
-int is_vol_small(const char *file);
 int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
 	u64 dev_cnt, int mixed, int ssd);
 int test_status_for_mkfs(const char *file, bool force_overwrite);
-- 
1.8.3.1


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

* Re: [PATCH v2] btrfs-progs: delete unused is_vol_small() and BTRFS_MKFS_SMALL_VOLUME_SIZE
  2018-09-26  7:44 ` [PATCH v2] " Anand Jain
@ 2018-09-26  7:51   ` Qu Wenruo
  0 siblings, 0 replies; 6+ messages in thread
From: Qu Wenruo @ 2018-09-26  7:51 UTC (permalink / raw)
  To: Anand Jain, linux-btrfs


[-- Attachment #1.1: Type: text/plain, Size: 2269 bytes --]



On 2018/9/26 下午3:44, Anand Jain wrote:
> Since commit c11e36a29e84 (Btrfs-progs: Do not force mixed block group
> creation unless '-M' option is specified) we don't have automatic
> mixed mode, and the function is_vol_small() and
> the define BTRFS_MKFS_SMALL_VOLUME_SIZE become obsolete, so clean it up.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
> v1->v2: drop is_vol_small() in mkfs/common.h
>  mkfs/common.c | 29 -----------------------------
>  mkfs/common.h |  2 --
>  2 files changed, 31 deletions(-)
> 
> diff --git a/mkfs/common.c b/mkfs/common.c
> index 0ace262b0e5f..c59e1d8eda4a 100644
> --- a/mkfs/common.c
> +++ b/mkfs/common.c
> @@ -772,35 +772,6 @@ int test_status_for_mkfs(const char *file, bool force_overwrite)
>  	return 0;
>  }
>  
> -int is_vol_small(const char *file)
> -{
> -	int fd = -1;
> -	int e;
> -	struct stat st;
> -	u64 size;
> -
> -	fd = open(file, O_RDONLY);
> -	if (fd < 0)
> -		return -errno;
> -	if (fstat(fd, &st) < 0) {
> -		e = -errno;
> -		close(fd);
> -		return e;
> -	}
> -	size = btrfs_device_size(fd, &st);
> -	if (size == 0) {
> -		close(fd);
> -		return -1;
> -	}
> -	if (size < BTRFS_MKFS_SMALL_VOLUME_SIZE) {
> -		close(fd);
> -		return 1;
> -	} else {
> -		close(fd);
> -		return 0;
> -	}
> -}
> -
>  int test_minimum_size(const char *file, u64 min_dev_size)
>  {
>  	int fd;
> diff --git a/mkfs/common.h b/mkfs/common.h
> index 28912906d0a9..b0ac3e35c6e9 100644
> --- a/mkfs/common.h
> +++ b/mkfs/common.h
> @@ -26,7 +26,6 @@
>  #include "common-defs.h"
>  
>  #define BTRFS_MKFS_SYSTEM_GROUP_SIZE SZ_4M
> -#define BTRFS_MKFS_SMALL_VOLUME_SIZE SZ_1G
>  
>  /*
>   * Tree root blocks created during mkfs
> @@ -69,7 +68,6 @@ int make_btrfs(int fd, struct btrfs_mkfs_config *cfg);
>  u64 btrfs_min_dev_size(u32 nodesize, int mixed, u64 meta_profile,
>  		       u64 data_profile);
>  int test_minimum_size(const char *file, u64 min_dev_size);
> -int is_vol_small(const char *file);
>  int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
>  	u64 dev_cnt, int mixed, int ssd);
>  int test_status_for_mkfs(const char *file, bool force_overwrite);
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2018-09-26  7:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-26  7:36 [PATCH] btrfs-progs: delete unused is_vol_small() and BTRFS_MKFS_SMALL_VOLUME_SIZE Anand Jain
2018-09-26  7:38 ` Qu Wenruo
2018-09-26  7:39 ` Qu Wenruo
2018-09-26  7:42   ` Anand Jain
2018-09-26  7:44 ` [PATCH v2] " Anand Jain
2018-09-26  7:51   ` Qu Wenruo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.