From 6b539bbbc4f671aaa4d59de6ee1030cecc7b2778 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Fri, 3 Jun 2022 17:24:38 +0200 Subject: [PATCH] btrfs-progs: libbtrfs: move extent_io.h to ctree.h Move the remaining structure definitions and prototypes to ctree.h that is now the only user. Signed-off-by: David Sterba --- Makefile | 3 +- libbtrfs/ctree.h | 36 ++++++++++++++++++++++-- libbtrfs/extent_io.h | 67 -------------------------------------------- tests/library-test.c | 2 -- 4 files changed, 35 insertions(+), 73 deletions(-) delete mode 100644 libbtrfs/extent_io.h diff --git a/Makefile b/Makefile index b16a8e98..eb049ab9 100644 --- a/Makefile +++ b/Makefile @@ -214,8 +214,7 @@ libbtrfs_objects = \ libbtrfs_headers = libbtrfs/send-stream.h libbtrfs/send-utils.h libbtrfs/send.h kernel-lib/rbtree.h \ kernel-lib/list.h kernel-lib/rbtree_types.h kerncompat.h \ - libbtrfs/extent-cache.h libbtrfs/extent_io.h ioctl.h \ - libbtrfs/ctree.h version.h + libbtrfs/extent-cache.h ioctl.h libbtrfs/ctree.h version.h libbtrfsutil_major := $(shell sed -rn 's/^\#define BTRFS_UTIL_VERSION_MAJOR ([0-9])+$$/\1/p' libbtrfsutil/btrfsutil.h) libbtrfsutil_minor := $(shell sed -rn 's/^\#define BTRFS_UTIL_VERSION_MINOR ([0-9])+$$/\1/p' libbtrfsutil/btrfsutil.h) libbtrfsutil_patch := $(shell sed -rn 's/^\#define BTRFS_UTIL_VERSION_PATCH ([0-9])+$$/\1/p' libbtrfsutil/btrfsutil.h) diff --git a/libbtrfs/ctree.h b/libbtrfs/ctree.h index f44dce2a..690462d8 100644 --- a/libbtrfs/ctree.h +++ b/libbtrfs/ctree.h @@ -25,13 +25,11 @@ #include "kernel-lib/list.h" #include "kerncompat.h" #include "libbtrfs/extent-cache.h" -#include "libbtrfs/extent_io.h" #include "ioctl.h" #else #include #include #include -#include #include #endif /* BTRFS_FLAT_INCLUDES */ @@ -212,6 +210,35 @@ struct btrfs_key { u64 offset; } __attribute__ ((__packed__)); +struct extent_io_tree { + struct cache_tree state; + struct cache_tree cache; + struct list_head lru; + u64 cache_size; + u64 max_cache_size; +}; + +struct extent_state { + struct cache_extent cache_node; + u64 start; + u64 end; + int refs; + unsigned long state; + u64 xprivate; +}; + +struct extent_buffer { + struct cache_extent cache_node; + u64 start; + struct list_head lru; + struct list_head recow; + u32 len; + int refs; + u32 flags; + struct btrfs_fs_info *fs_info; + char data[] __attribute__((aligned(8))); +}; + struct btrfs_mapping_tree { struct cache_tree cache_tree; }; @@ -1552,6 +1579,11 @@ static inline u32 BTRFS_MAX_XATTR_SIZE(const struct btrfs_fs_info *info) #define BTRFS_INODE_DIRSYNC (1 << 10) #define BTRFS_INODE_COMPRESS (1 << 11) +void read_extent_buffer(const struct extent_buffer *eb, void *dst, + unsigned long start, unsigned long len); +void write_extent_buffer(struct extent_buffer *eb, const void *src, + unsigned long start, unsigned long len); + #define read_eb_member(eb, ptr, type, member, result) ( \ read_extent_buffer(eb, (char *)(result), \ ((unsigned long)(ptr)) + \ diff --git a/libbtrfs/extent_io.h b/libbtrfs/extent_io.h deleted file mode 100644 index d97bac3d..00000000 --- a/libbtrfs/extent_io.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2007 Oracle. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License v2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 021110-1307, USA. - */ - -#ifndef __BTRFS_EXTENT_IO_H__ -#define __BTRFS_EXTENT_IO_H__ - -#if BTRFS_FLAT_INCLUDES -#include "kerncompat.h" -#include "libbtrfs/extent-cache.h" -#include "kernel-lib/list.h" -#else -#include -#include -#include -#endif /* BTRFS_FLAT_INCLUDES */ - -struct btrfs_fs_info; - -struct extent_io_tree { - struct cache_tree state; - struct cache_tree cache; - struct list_head lru; - u64 cache_size; - u64 max_cache_size; -}; - -struct extent_state { - struct cache_extent cache_node; - u64 start; - u64 end; - int refs; - unsigned long state; - u64 xprivate; -}; - -struct extent_buffer { - struct cache_extent cache_node; - u64 start; - struct list_head lru; - struct list_head recow; - u32 len; - int refs; - u32 flags; - struct btrfs_fs_info *fs_info; - char data[] __attribute__((aligned(8))); -}; - -void read_extent_buffer(const struct extent_buffer *eb, void *dst, - unsigned long start, unsigned long len); -void write_extent_buffer(struct extent_buffer *eb, const void *src, - unsigned long start, unsigned long len); -#endif diff --git a/tests/library-test.c b/tests/library-test.c index 6c27403e..fe55e9bc 100644 --- a/tests/library-test.c +++ b/tests/library-test.c @@ -22,7 +22,6 @@ #include "kernel-lib/rbtree.h" #include "kernel-lib/list.h" #include "kernel-shared/ctree.h" -#include "kernel-shared/extent_io.h" #include "ioctl.h" #include "common/extent-cache.h" #include "kernel-shared/send.h" @@ -38,7 +37,6 @@ #include "btrfs/rbtree.h" #include "btrfs/list.h" #include "btrfs/ctree.h" -#include "btrfs/extent_io.h" #include "btrfs/ioctl.h" #include "btrfs/extent-cache.h" #include "btrfs/send.h"