diff mbox series

btrfs-progs: delete unused is_vol_small() and BTRFS_MKFS_SMALL_VOLUME_SIZE

Message ID 1537947388-10396-1-git-send-email-anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: delete unused is_vol_small() and BTRFS_MKFS_SMALL_VOLUME_SIZE | expand

Commit Message

Anand Jain Sept. 26, 2018, 7:36 a.m. UTC
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(-)

Comments

Qu Wenruo Sept. 26, 2018, 7:38 a.m. UTC | #1
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
>
Qu Wenruo Sept. 26, 2018, 7:39 a.m. UTC | #2
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
>
Anand Jain Sept. 26, 2018, 7:42 a.m. UTC | #3
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
>>
>
diff mbox series

Patch

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