Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
94c2606
Documentation
arch
block
crypto
drivers
firmware
fs
9p
adfs
affs
afs
autofs4
befs
bfs
btrfs
tests
Kconfig
Makefile
acl.c
async-thread.c
async-thread.h
backref.c
backref.h
btrfs_inode.h
check-integrity.c
check-integrity.h
compression.c
compression.h
ctree.c
ctree.h
delayed-inode.c
delayed-inode.h
delayed-ref.c
delayed-ref.h
dev-replace.c
dev-replace.h
dir-item.c
disk-io.c
disk-io.h
export.c
export.h
extent-tree.c
extent_io.c
extent_io.h
extent_map.c
extent_map.h
file-item.c
file.c
free-space-cache.c
free-space-cache.h
hash.c
hash.h
inode-item.c
inode-map.c
inode-map.h
inode.c
ioctl.c
locking.c
locking.h
lzo.c
math.h
ordered-data.c
ordered-data.h
orphan.c
print-tree.c
print-tree.h
props.c
props.h
qgroup.c
qgroup.h
raid56.c
raid56.h
rcu-string.h
reada.c
relocation.c
root-tree.c
scrub.c
send.c
send.h
struct-funcs.c
super.c
sysfs.c
sysfs.h
transaction.c
transaction.h
tree-defrag.c
tree-log.c
tree-log.h
ulist.c
ulist.h
uuid-tree.c
volumes.c
volumes.h
xattr.c
xattr.h
zlib.c
cachefiles
ceph
cifs
coda
configfs
cramfs
debugfs
devpts
dlm
ecryptfs
efivarfs
efs
exofs
exportfs
ext2
ext3
ext4
f2fs
fat
freevxfs
fscache
fuse
gfs2
hfs
hfsplus
hostfs
hpfs
hppfs
hugetlbfs
isofs
jbd
jbd2
jffs2
jfs
kernfs
lockd
logfs
minix
ncpfs
nfs
nfs_common
nfsd
nilfs2
nls
notify
ntfs
ocfs2
omfs
openpromfs
proc
pstore
qnx4
qnx6
quota
ramfs
reiserfs
romfs
squashfs
sysfs
sysv
ubifs
udf
ufs
xfs
Kconfig
Kconfig.binfmt
Makefile
aio.c
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf.c
binfmt_elf_fdpic.c
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
binfmt_som.c
block_dev.c
buffer.c
char_dev.c
compat.c
compat_binfmt_elf.c
compat_ioctl.c
coredump.c
dcache.c
dcookies.c
direct-io.c
drop_caches.c
eventfd.c
eventpoll.c
exec.c
fcntl.c
fhandle.c
file.c
file_table.c
filesystems.c
fs-writeback.c
fs_pin.c
fs_struct.c
inode.c
internal.h
ioctl.c
libfs.c
locks.c
mbcache.c
mount.h
mpage.c
namei.c
namespace.c
no-block.c
open.c
pipe.c
pnode.c
pnode.h
posix_acl.c
proc_namespace.c
read_write.c
readdir.c
select.c
seq_file.c
signalfd.c
splice.c
stack.c
stat.c
statfs.c
super.c
sync.c
timerfd.c
utimes.c
xattr.c
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
fs
/
btrfs
/
ordered-data.h
Blame
Blame
Latest commit
History
History
210 lines (175 loc) · 6.76 KB
Breadcrumbs
linux
/
fs
/
btrfs
/
ordered-data.h
Top
File metadata and controls
Code
Blame
210 lines (175 loc) · 6.76 KB
Raw
/* * 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_ORDERED_DATA__ #define __BTRFS_ORDERED_DATA__ /* one of these per inode */ struct btrfs_ordered_inode_tree { spinlock_t lock; struct rb_root tree; struct rb_node *last; }; struct btrfs_ordered_sum { /* bytenr is the start of this extent on disk */ u64 bytenr; /* * this is the length in bytes covered by the sums array below. */ int len; struct list_head list; /* last field is a variable length array of csums */ u32 sums[]; }; /* * bits for the flags field: * * BTRFS_ORDERED_IO_DONE is set when all of the blocks are written. * It is used to make sure metadata is inserted into the tree only once * per extent. * * BTRFS_ORDERED_COMPLETE is set when the extent is removed from the * rbtree, just before waking any waiters. It is used to indicate the * IO is done and any metadata is inserted into the tree. */ #define BTRFS_ORDERED_IO_DONE 0 /* set when all the pages are written */ #define BTRFS_ORDERED_COMPLETE 1 /* set when removed from the tree */ #define BTRFS_ORDERED_NOCOW 2 /* set when we want to write in place */ #define BTRFS_ORDERED_COMPRESSED 3 /* writing a zlib compressed extent */ #define BTRFS_ORDERED_PREALLOC 4 /* set when writing to prealloced extent */ #define BTRFS_ORDERED_DIRECT 5 /* set when we're doing DIO with this extent */ #define BTRFS_ORDERED_IOERR 6 /* We had an io error when writing this out */ #define BTRFS_ORDERED_UPDATED_ISIZE 7 /* indicates whether this ordered extent * has done its due diligence in updating * the isize. */ #define BTRFS_ORDERED_LOGGED_CSUM 8 /* We've logged the csums on this ordered ordered extent */ #define BTRFS_ORDERED_TRUNCATED 9 /* Set when we have to truncate an extent */ #define BTRFS_ORDERED_LOGGED 10 /* Set when we've waited on this ordered extent * in the logging code. */ struct btrfs_ordered_extent { /* logical offset in the file */ u64 file_offset; /* disk byte number */ u64 start; /* ram length of the extent in bytes */ u64 len; /* extent length on disk */ u64 disk_len; /* number of bytes that still need writing */ u64 bytes_left; /* number of bytes that still need csumming */ u64 csum_bytes_left; /* * the end of the ordered extent which is behind it but * didn't update disk_i_size. Please see the comment of * btrfs_ordered_update_i_size(); */ u64 outstanding_isize; /* * If we get truncated we need to adjust the file extent we enter for * this ordered extent so that we do not expose stale data. */ u64 truncated_len; /* flags (described above) */ unsigned long flags; /* compression algorithm */ int compress_type; /* reference count */ atomic_t refs; /* the inode we belong to */ struct inode *inode; /* list of checksums for insertion when the extent io is done */ struct list_head list; /* If we need to wait on this to be done */ struct list_head log_list; /* If the transaction needs to wait on this ordered extent */ struct list_head trans_list; /* used to wait for the BTRFS_ORDERED_COMPLETE bit */ wait_queue_head_t wait; /* our friendly rbtree entry */ struct rb_node rb_node; /* a per root list of all the pending ordered extents */ struct list_head root_extent_list; struct btrfs_work work; struct completion completion; struct btrfs_work flush_work; struct list_head work_list; }; /* * calculates the total size you need to allocate for an ordered sum * structure spanning 'bytes' in the file */ static inline int btrfs_ordered_sum_size(struct btrfs_root *root, unsigned long bytes) { int num_sectors = (int)DIV_ROUND_UP(bytes, root->sectorsize); return sizeof(struct btrfs_ordered_sum) + num_sectors * sizeof(u32); } static inline void btrfs_ordered_inode_tree_init(struct btrfs_ordered_inode_tree *t) { spin_lock_init(&t->lock); t->tree = RB_ROOT; t->last = NULL; } void btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry); void btrfs_remove_ordered_extent(struct inode *inode, struct btrfs_ordered_extent *entry); int btrfs_dec_test_ordered_pending(struct inode *inode, struct btrfs_ordered_extent **cached, u64 file_offset, u64 io_size, int uptodate); int btrfs_dec_test_first_ordered_pending(struct inode *inode, struct btrfs_ordered_extent **cached, u64 *file_offset, u64 io_size, int uptodate); int btrfs_add_ordered_extent(struct inode *inode, u64 file_offset, u64 start, u64 len, u64 disk_len, int type); int btrfs_add_ordered_extent_dio(struct inode *inode, u64 file_offset, u64 start, u64 len, u64 disk_len, int type); int btrfs_add_ordered_extent_compress(struct inode *inode, u64 file_offset, u64 start, u64 len, u64 disk_len, int type, int compress_type); void btrfs_add_ordered_sum(struct inode *inode, struct btrfs_ordered_extent *entry, struct btrfs_ordered_sum *sum); struct btrfs_ordered_extent *btrfs_lookup_ordered_extent(struct inode *inode, u64 file_offset); void btrfs_start_ordered_extent(struct inode *inode, struct btrfs_ordered_extent *entry, int wait); int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len); struct btrfs_ordered_extent * btrfs_lookup_first_ordered_extent(struct inode * inode, u64 file_offset); struct btrfs_ordered_extent *btrfs_lookup_ordered_range(struct inode *inode, u64 file_offset, u64 len); int btrfs_ordered_update_i_size(struct inode *inode, u64 offset, struct btrfs_ordered_extent *ordered); int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr, u32 *sum, int len); int btrfs_wait_ordered_extents(struct btrfs_root *root, int nr); void btrfs_wait_ordered_roots(struct btrfs_fs_info *fs_info, int nr); void btrfs_get_logged_extents(struct inode *inode, struct list_head *logged_list); void btrfs_put_logged_extents(struct list_head *logged_list); void btrfs_submit_logged_extents(struct list_head *logged_list, struct btrfs_root *log); void btrfs_wait_logged_extents(struct btrfs_trans_handle *trans, struct btrfs_root *log, u64 transid); void btrfs_free_logged_extents(struct btrfs_root *log, u64 transid); int __init ordered_data_init(void); void ordered_data_exit(void); #endif
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
You can’t perform that action at this time.