Blame view
fs/btrfs/btrfs_inode.h
5.28 KB
6cbd55707 Btrfs: add GPLv2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
/* * 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. */ |
2c90e5d65 Btrfs: still corr... |
18 19 |
#ifndef __BTRFS_I__ #define __BTRFS_I__ |
a52d9a803 Btrfs: Extent bas... |
20 |
#include "extent_map.h" |
d1310b2e0 Btrfs: Split the ... |
21 |
#include "extent_io.h" |
e6dcd2dc9 Btrfs: New data=o... |
22 |
#include "ordered-data.h" |
16cdcec73 btrfs: implement ... |
23 |
#include "delayed-inode.h" |
a52d9a803 Btrfs: Extent bas... |
24 |
|
f1ace244c btrfs: Code cleanup |
25 |
/* in memory btrfs inode */ |
2c90e5d65 Btrfs: still corr... |
26 |
struct btrfs_inode { |
d352ac681 Btrfs: add and im... |
27 |
/* which subvolume this inode belongs to */ |
d6e4a428e Btrfs: start of s... |
28 |
struct btrfs_root *root; |
d352ac681 Btrfs: add and im... |
29 |
|
d352ac681 Btrfs: add and im... |
30 31 32 |
/* key used to find this inode on disk. This is used by the code * to read in roots of subvolumes */ |
d6e4a428e Btrfs: start of s... |
33 |
struct btrfs_key location; |
d352ac681 Btrfs: add and im... |
34 |
|
9e0baf60d Btrfs: fix enospc... |
35 36 |
/* Lock for counters */ spinlock_t lock; |
d352ac681 Btrfs: add and im... |
37 |
/* the extent_tree has caches of all the extent mappings to disk */ |
a52d9a803 Btrfs: Extent bas... |
38 |
struct extent_map_tree extent_tree; |
d352ac681 Btrfs: add and im... |
39 40 |
/* the io_tree does range state (DIRTY, LOCKED etc) */ |
d1310b2e0 Btrfs: Split the ... |
41 |
struct extent_io_tree io_tree; |
d352ac681 Btrfs: add and im... |
42 43 44 45 |
/* special utility tree used to record which mirrors have already been * tried when checksums fail for a given block */ |
7e38326f5 Btrfs: Handle che... |
46 |
struct extent_io_tree io_failure_tree; |
d352ac681 Btrfs: add and im... |
47 |
|
d352ac681 Btrfs: add and im... |
48 |
/* held while logging the inode in tree-log.c */ |
e02119d5a Btrfs: Add a writ... |
49 |
struct mutex log_mutex; |
d352ac681 Btrfs: add and im... |
50 51 |
/* used to order data wrt metadata */ |
e6dcd2dc9 Btrfs: New data=o... |
52 |
struct btrfs_ordered_inode_tree ordered_tree; |
15ee9bc7e Btrfs: delay comm... |
53 |
|
7b1287662 Btrfs: Create orp... |
54 55 |
/* for keeping track of orphaned inodes */ struct list_head i_orphan; |
d352ac681 Btrfs: add and im... |
56 57 58 59 |
/* list of all the delalloc inodes in the FS. There are times we need * to write all the delalloc pages to disk, and this list is used * to walk them all. */ |
ea8c28194 Btrfs: Maintain a... |
60 |
struct list_head delalloc_inodes; |
5a3f23d51 Btrfs: add extra ... |
61 62 63 64 65 |
/* * list for tracking inodes that must be sent to disk before a * rename or truncate commit */ struct list_head ordered_operations; |
5d4f98a28 Btrfs: Mixed back... |
66 67 |
/* node for the red-black tree that links inodes in subvolume root */ struct rb_node rb_node; |
6a63209fc Btrfs: add better... |
68 69 |
/* the space_info for where this inode's data allocations are done */ struct btrfs_space_info *space_info; |
d352ac681 Btrfs: add and im... |
70 71 72 |
/* full 64 bit generation number, struct vfs_inode doesn't have a big * enough field for this. */ |
e02119d5a Btrfs: Add a writ... |
73 |
u64 generation; |
c3027eb55 Btrfs: Add inode ... |
74 75 |
/* sequence number for NFS changes */ u64 sequence; |
15ee9bc7e Btrfs: delay comm... |
76 77 78 79 |
/* * transid of the trans_handle that last modified this inode */ u64 last_trans; |
257c62e1b Btrfs: avoid tree... |
80 81 82 83 84 |
/* * log transid when this inode was last modified */ u64 last_sub_trans; |
e02119d5a Btrfs: Add a writ... |
85 86 87 88 |
/* * transid that last logged this inode */ u64 logged_trans; |
49eb7e46d Btrfs: Dir fsync ... |
89 |
|
d352ac681 Btrfs: add and im... |
90 91 92 |
/* total number of bytes pending delalloc, used by stat to calc the * real block usage of the file */ |
9069218d4 Btrfs: Fix i_bloc... |
93 |
u64 delalloc_bytes; |
d352ac681 Btrfs: add and im... |
94 95 96 97 98 99 |
/* * the size of the file stored in the metadata on disk. data=ordered * means the in-memory i_size might be larger than the size on disk * because not all the blocks are written yet. */ |
dbe674a99 Btrfs: Update on ... |
100 |
u64 disk_i_size; |
d352ac681 Btrfs: add and im... |
101 |
|
aec7477b3 Btrfs: Implement ... |
102 103 104 105 106 |
/* * if this is a directory then index_cnt is the counter for the index * number for new files that are created */ u64 index_cnt; |
d352ac681 Btrfs: add and im... |
107 |
|
12fcfd22f Btrfs: tree loggi... |
108 109 110 111 112 113 |
/* the fsync log has some corner cases that mean we have to check * directories to see if any unlinks have been done before * the directory was logged. See tree-log.c for all the * details */ u64 last_unlink_trans; |
7709cde33 Btrfs: calculate ... |
114 115 116 117 118 |
/* * Number of bytes outstanding that are going to need csums. This is * used in ENOSPC accounting. */ u64 csum_bytes; |
f1bdcc0a8 Btrfs: move stuff... |
119 120 |
/* flags field from the on disk inode */ u32 flags; |
5a3f23d51 Btrfs: add extra ... |
121 |
/* |
32c00aff7 Btrfs: release de... |
122 123 124 125 |
* Counters to keep track of the number of extent item's we may use due * to delalloc and such. outstanding_extents is the number of extent * items we think we'll end up using, and reserved_extents is the number * of extent items we've reserved metadata for. |
9ed74f2db Btrfs: proper -EN... |
126 |
*/ |
9e0baf60d Btrfs: fix enospc... |
127 128 |
unsigned outstanding_extents; unsigned reserved_extents; |
9ed74f2db Btrfs: proper -EN... |
129 130 |
/* |
5a3f23d51 Btrfs: add extra ... |
131 132 133 134 135 |
* ordered_data_close is set by truncate when a file that used * to have good data has been truncated to zero. When it is set * the btrfs file release call will add this inode to the * ordered operations list so that we make sure to flush out any * new data the application may have written before commit. |
5a3f23d51 Btrfs: add extra ... |
136 137 |
*/ unsigned ordered_data_close:1; |
d68fc57b7 Btrfs: Metadata r... |
138 |
unsigned orphan_meta_reserved:1; |
4df27c4d5 Btrfs: change how... |
139 |
unsigned dummy_inode:1; |
4cb5300bc Btrfs: add mount ... |
140 |
unsigned in_defrag:1; |
7fd2ae21a Btrfs: fix our re... |
141 |
unsigned delalloc_meta_reserved:1; |
5a3f23d51 Btrfs: add extra ... |
142 |
|
1e701a329 Btrfs: add new de... |
143 144 145 |
/* * always compress this one file */ |
261507a02 btrfs: Allow to a... |
146 |
unsigned force_compress:4; |
1e701a329 Btrfs: add new de... |
147 |
|
16cdcec73 btrfs: implement ... |
148 |
struct btrfs_delayed_node *delayed_node; |
d352ac681 Btrfs: add and im... |
149 |
struct inode vfs_inode; |
2c90e5d65 Btrfs: still corr... |
150 |
}; |
dbe674a99 Btrfs: Update on ... |
151 |
|
16cdcec73 btrfs: implement ... |
152 |
extern unsigned char btrfs_filetype_table[]; |
2c90e5d65 Btrfs: still corr... |
153 154 155 156 |
static inline struct btrfs_inode *BTRFS_I(struct inode *inode) { return container_of(inode, struct btrfs_inode, vfs_inode); } |
33345d015 Btrfs: Always use... |
157 158 159 |
static inline u64 btrfs_ino(struct inode *inode) { u64 ino = BTRFS_I(inode)->location.objectid; |
14c7cca78 Btrfs: fix an oop... |
160 161 162 163 164 |
/* * !ino: btree_inode * type == BTRFS_ROOT_ITEM_KEY: subvol dir */ if (!ino || BTRFS_I(inode)->location.type == BTRFS_ROOT_ITEM_KEY) |
33345d015 Btrfs: Always use... |
165 166 167 |
ino = inode->i_ino; return ino; } |
dbe674a99 Btrfs: Update on ... |
168 169 |
static inline void btrfs_i_size_write(struct inode *inode, u64 size) { |
c21677545 Btrfs: Fix disk_i... |
170 |
i_size_write(inode, size); |
dbe674a99 Btrfs: Update on ... |
171 172 |
BTRFS_I(inode)->disk_i_size = size; } |
2cf8572da Btrfs: use the co... |
173 174 175 176 177 178 179 180 |
static inline bool btrfs_is_free_space_inode(struct btrfs_root *root, struct inode *inode) { if (root == root->fs_info->tree_root || BTRFS_I(inode)->location.objectid == BTRFS_FREE_INO_OBJECTID) return true; return false; } |
2c90e5d65 Btrfs: still corr... |
181 |
#endif |