diff mbox

[2/2] btrfs-progs: close_all_devices() declared in multiple files

Message ID 1373866527-10604-3-git-send-email-anand.jain@oracle.com (mailing list archive)
State Under Review, archived
Headers show

Commit Message

Anand Jain July 15, 2013, 5:35 a.m. UTC
close_all_devices() is declared once in disk-io.c and again
in btrfs-find-root.c I see no reasons or is there any ?

This patch will fix it.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 btrfs-find-root.c |   17 +----------------
 disk-io.c         |    3 +--
 disk-io.h         |    1 +
 3 files changed, 3 insertions(+), 18 deletions(-)

Comments

Stefan Behrens July 15, 2013, 8:06 a.m. UTC | #1
On Mon, 15 Jul 2013 13:35:27 +0800, Anand Jain wrote:
> close_all_devices() is declared once in disk-io.c and again
> in btrfs-find-root.c I see no reasons or is there any ?
> 
> This patch will fix it.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  btrfs-find-root.c |   17 +----------------
>  disk-io.c         |    3 +--
>  disk-io.h         |    1 +
>  3 files changed, 3 insertions(+), 18 deletions(-)
> 
> diff --git a/btrfs-find-root.c b/btrfs-find-root.c
> index 253c200..82440f6 100644
> --- a/btrfs-find-root.c
> +++ b/btrfs-find-root.c
> @@ -34,6 +34,7 @@
>  #include "volumes.h"
>  #include "utils.h"
>  #include "crc32c.h"
> +#include "disk-io.h"
>  
>  static u16 csum_size = 0;
>  static u64 search_objectid = BTRFS_ROOT_TREE_OBJECTID;
> @@ -65,22 +66,6 @@ int csum_block(void *buf, u32 len)
>  	return ret;
>  }
>  
> -static int close_all_devices(struct btrfs_fs_info *fs_info)
> -{
> -	struct list_head *list;
> -	struct list_head *next;
> -	struct btrfs_device *device;
> -
> -	return 0;

Nice and useful function :)

This function is not equal to the one from disk-io.c, only the function
name is equal. But looking at the code, this patch should work. Maybe
the commit message could be improved since it reads as if it would
handle two equal functions and this is not the case.


> -
> -	list = &fs_info->fs_devices->devices;
> -	list_for_each(next, list) {
> -		device = list_entry(next, struct btrfs_device, dev_list);
> -		close(device->fd);
> -	}
> -	return 0;
> -}
> -
>  static struct btrfs_root *open_ctree_broken(int fd, const char *device)
>  {
>  	u32 sectorsize;
> diff --git a/disk-io.c b/disk-io.c
> index 5b84b02..d23c4d9 100644
> --- a/disk-io.c
> +++ b/disk-io.c
> @@ -35,7 +35,6 @@
>  #include "utils.h"
>  #include "print-tree.h"
>  
> -static int close_all_devices(struct btrfs_fs_info *fs_info);
>  
>  static int check_tree_block(struct btrfs_root *root, struct extent_buffer *buf)
>  {
> @@ -1165,7 +1164,7 @@ int write_ctree_super(struct btrfs_trans_handle *trans,
>  	return ret;
>  }
>  
> -static int close_all_devices(struct btrfs_fs_info *fs_info)
> +int close_all_devices(struct btrfs_fs_info *fs_info)
>  {
>  	struct list_head *list;
>  	struct btrfs_device *device;
> diff --git a/disk-io.h b/disk-io.h
> index 0158d17..c25bc07 100644
> --- a/disk-io.h
> +++ b/disk-io.h
> @@ -89,6 +89,7 @@ int csum_tree_block_size(struct extent_buffer *buf, u16 csum_sectorsize,
>  int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
>  		    int verify);
>  int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid);
> +int close_all_devices(struct btrfs_fs_info *fs_info);
>  #endif
>  
>  /* raid6.c */
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/btrfs-find-root.c b/btrfs-find-root.c
index 253c200..82440f6 100644
--- a/btrfs-find-root.c
+++ b/btrfs-find-root.c
@@ -34,6 +34,7 @@ 
 #include "volumes.h"
 #include "utils.h"
 #include "crc32c.h"
+#include "disk-io.h"
 
 static u16 csum_size = 0;
 static u64 search_objectid = BTRFS_ROOT_TREE_OBJECTID;
@@ -65,22 +66,6 @@  int csum_block(void *buf, u32 len)
 	return ret;
 }
 
-static int close_all_devices(struct btrfs_fs_info *fs_info)
-{
-	struct list_head *list;
-	struct list_head *next;
-	struct btrfs_device *device;
-
-	return 0;
-
-	list = &fs_info->fs_devices->devices;
-	list_for_each(next, list) {
-		device = list_entry(next, struct btrfs_device, dev_list);
-		close(device->fd);
-	}
-	return 0;
-}
-
 static struct btrfs_root *open_ctree_broken(int fd, const char *device)
 {
 	u32 sectorsize;
diff --git a/disk-io.c b/disk-io.c
index 5b84b02..d23c4d9 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -35,7 +35,6 @@ 
 #include "utils.h"
 #include "print-tree.h"
 
-static int close_all_devices(struct btrfs_fs_info *fs_info);
 
 static int check_tree_block(struct btrfs_root *root, struct extent_buffer *buf)
 {
@@ -1165,7 +1164,7 @@  int write_ctree_super(struct btrfs_trans_handle *trans,
 	return ret;
 }
 
-static int close_all_devices(struct btrfs_fs_info *fs_info)
+int close_all_devices(struct btrfs_fs_info *fs_info)
 {
 	struct list_head *list;
 	struct btrfs_device *device;
diff --git a/disk-io.h b/disk-io.h
index 0158d17..c25bc07 100644
--- a/disk-io.h
+++ b/disk-io.h
@@ -89,6 +89,7 @@  int csum_tree_block_size(struct extent_buffer *buf, u16 csum_sectorsize,
 int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
 		    int verify);
 int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid);
+int close_all_devices(struct btrfs_fs_info *fs_info);
 #endif
 
 /* raid6.c */