aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2011-04-19 22:33:24 -0400
committerLi Zefan <lizf@cn.fujitsu.com>2011-04-25 04:46:11 -0400
commit82d5902d9c681be37ffa9d70482907f9f0b7ec1f (patch)
treec9c99f0b60004ac14d09d277d3216667df09c32d /fs/btrfs/ctree.h
parent33345d01522f8152f99dc84a3e7a1a45707f387f (diff)
Btrfs: Support reading/writing on disk free ino cache
This is similar to block group caching. We dedicate a special inode in fs tree to save free ino cache. At the very first time we create/delete a file after mount, the free ino cache will be loaded from disk into memory. When the fs tree is commited, the cache will be written back to disk. To keep compatibility, we check the root generation against the generation of the special inode when loading the cache, so the loading will fail if the btrfs filesystem was mounted in an older kernel before. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index c96a4e4c5566..b20082e27a9f 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -105,6 +105,12 @@ struct btrfs_ordered_sum;
105/* For storing free space cache */ 105/* For storing free space cache */
106#define BTRFS_FREE_SPACE_OBJECTID -11ULL 106#define BTRFS_FREE_SPACE_OBJECTID -11ULL
107 107
108/*
109 * The inode number assigned to the special inode for sotring
110 * free ino cache
111 */
112#define BTRFS_FREE_INO_OBJECTID -12ULL
113
108/* dummy objectid represents multiple objectids */ 114/* dummy objectid represents multiple objectids */
109#define BTRFS_MULTIPLE_OBJECTIDS -255ULL 115#define BTRFS_MULTIPLE_OBJECTIDS -255ULL
110 116
@@ -1110,6 +1116,7 @@ struct btrfs_root {
1110 wait_queue_head_t cache_wait; 1116 wait_queue_head_t cache_wait;
1111 struct btrfs_free_space_ctl *free_ino_pinned; 1117 struct btrfs_free_space_ctl *free_ino_pinned;
1112 u64 cache_progress; 1118 u64 cache_progress;
1119 struct inode *cache_inode;
1113 1120
1114 struct mutex log_mutex; 1121 struct mutex log_mutex;
1115 wait_queue_head_t log_writer_wait; 1122 wait_queue_head_t log_writer_wait;