From 355844f86bbaa9a57d9176a32b4144442bbbe635 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-cache.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 | 2 +- libbtrfs/ctree.h | 15 +++++++++++++-- libbtrfs/extent-cache.h | 41 ----------------------------------------- tests/library-test.c | 2 -- 4 files changed, 14 insertions(+), 46 deletions(-) delete mode 100644 libbtrfs/extent-cache.h diff --git a/Makefile b/Makefile index eb049ab9..ea5a1ae8 100644 --- a/Makefile +++ b/Makefile @@ -214,7 +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 ioctl.h libbtrfs/ctree.h version.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 690462d8..5374dc5d 100644 --- a/libbtrfs/ctree.h +++ b/libbtrfs/ctree.h @@ -23,13 +23,13 @@ #if BTRFS_FLAT_INCLUDES #include "kernel-lib/list.h" +#include "kernel-lib/rbtree.h" #include "kerncompat.h" -#include "libbtrfs/extent-cache.h" #include "ioctl.h" #else #include +#include #include -#include #include #endif /* BTRFS_FLAT_INCLUDES */ @@ -210,6 +210,17 @@ struct btrfs_key { u64 offset; } __attribute__ ((__packed__)); +struct cache_tree { + struct rb_root root; +}; + +struct cache_extent { + struct rb_node rb_node; + u64 objectid; + u64 start; + u64 size; +}; + struct extent_io_tree { struct cache_tree state; struct cache_tree cache; diff --git a/libbtrfs/extent-cache.h b/libbtrfs/extent-cache.h deleted file mode 100644 index fbdab929..00000000 --- a/libbtrfs/extent-cache.h +++ /dev/null @@ -1,41 +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_CACHE_H__ -#define __BTRFS_EXTENT_CACHE_H__ - -#if BTRFS_FLAT_INCLUDES -#include "kerncompat.h" -#include "kernel-lib/rbtree.h" -#else -#include -#include -#endif /* BTRFS_FLAT_INCLUDES */ - -struct cache_tree { - struct rb_root root; -}; - -struct cache_extent { - struct rb_node rb_node; - u64 objectid; - u64 start; - u64 size; -}; - -#endif diff --git a/tests/library-test.c b/tests/library-test.c index fe55e9bc..d2ac56ae 100644 --- a/tests/library-test.c +++ b/tests/library-test.c @@ -23,7 +23,6 @@ #include "kernel-lib/list.h" #include "kernel-shared/ctree.h" #include "ioctl.h" -#include "common/extent-cache.h" #include "kernel-shared/send.h" #include "common/send-stream.h" #include "common/send-utils.h" @@ -38,7 +37,6 @@ #include "btrfs/list.h" #include "btrfs/ctree.h" #include "btrfs/ioctl.h" -#include "btrfs/extent-cache.h" #include "btrfs/send.h" #include "btrfs/send-stream.h" #include "btrfs/send-utils.h"