2 * Copyright (C) 2007 Oracle. All rights reserved.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 * Boston, MA 021110-1307, USA.
19 #ifndef __BTRFS_ORDERED_DATA__
20 #define __BTRFS_ORDERED_DATA__
22 struct btrfs_ordered_inode_tree
{
28 struct btrfs_sector_sum
{
33 struct btrfs_ordered_sum
{
36 struct list_head list
;
37 struct btrfs_sector_sum sums
;
40 /* bits for the flags field */
41 #define BTRFS_ORDERED_IO_DONE 0 /* set when all the pages are written */
42 #define BTRFS_ORDERED_COMPLETE 1 /* set when removed from the tree */
43 #define BTRFS_ORDERED_START 2 /* set when tree setup */
45 struct btrfs_ordered_extent
{
51 struct list_head list
;
53 wait_queue_head_t wait
;
54 struct rb_node rb_node
;
58 static inline int btrfs_ordered_sum_size(struct btrfs_root
*root
, u64 bytes
)
60 unsigned long num_sectors
= (bytes
+ root
->sectorsize
- 1) /
62 return sizeof(struct btrfs_ordered_sum
) +
63 num_sectors
* sizeof(struct btrfs_sector_sum
);
67 btrfs_ordered_inode_tree_init(struct btrfs_ordered_inode_tree
*t
)
69 mutex_init(&t
->mutex
);
70 t
->tree
.rb_node
= NULL
;
74 int btrfs_put_ordered_extent(struct btrfs_ordered_extent
*entry
);
75 int btrfs_remove_ordered_extent(struct inode
*inode
,
76 struct btrfs_ordered_extent
*entry
);
77 int btrfs_dec_test_ordered_pending(struct inode
*inode
,
78 u64 file_offset
, u64 io_size
);
79 int btrfs_add_ordered_extent(struct inode
*inode
, u64 file_offset
,
81 int btrfs_add_ordered_sum(struct inode
*inode
, struct btrfs_ordered_sum
*sum
);
82 struct btrfs_ordered_extent
*btrfs_lookup_ordered_extent(struct inode
*inode
,
84 void btrfs_wait_ordered_extent(struct inode
*inode
,
85 struct btrfs_ordered_extent
*entry
);
86 void btrfs_wait_ordered_range(struct inode
*inode
, u64 start
, u64 len
);
87 struct btrfs_ordered_extent
*
88 btrfs_lookup_first_ordered_extent(struct inode
* inode
, u64 file_offset
);
89 int btrfs_add_ordered_pending(struct inode
*inode
,
90 struct btrfs_ordered_extent
*ordered
,
This page took 0.062338 seconds and 6 git commands to generate.