revert-mm-fix-blkdev-size-calculation-in-generic_write_checks
[linux-2.6/linux-trees-mm.git] / fs / reiser4 / plugin / item / ctail.h
blobd18e04632ffe4f7ce379fdf6f14083c41e49db0e
1 /* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
3 /* Ctail items are fragments (or bodies) of special tipe to provide
4 optimal storage of encrypted and(or) compressed files. */
7 #if !defined( __FS_REISER4_CTAIL_H__ )
8 #define __FS_REISER4_CTAIL_H__
10 /* Disk format of ctail item */
11 typedef struct ctail_item_format {
12 /* packed shift;
13 if its value is different from UCTAIL_SHIFT (see below), then
14 size of disk cluster is calculated as (1 << cluster_shift) */
15 d8 cluster_shift;
16 /* ctail body */
17 d8 body[0];
18 } __attribute__ ((packed)) ctail_item_format;
20 /* "Unprepped" disk cluster is represented by a single ctail item
21 with the following "magic" attributes: */
22 /* "magic" cluster_shift */
23 #define UCTAIL_SHIFT 0xff
24 /* How many units unprepped ctail item has */
25 #define UCTAIL_NR_UNITS 1
27 /* The following is a set of various item states in a disk cluster.
28 Disk cluster is a set of items whose keys belong to the interval
29 [dc_key , dc_key + disk_cluster_size - 1] */
30 typedef enum {
31 DC_INVALID_STATE = 0,
32 DC_FIRST_ITEM = 1,
33 DC_CHAINED_ITEM = 2,
34 DC_AFTER_CLUSTER = 3
35 } dc_item_stat;
37 /* ctail-specific extension.
38 In particular this describes parameters of disk cluster an item belongs to */
39 struct ctail_coord_extension {
40 int shift; /* this contains cluster_shift extracted from
41 ctail_item_format (above), or UCTAIL_SHIFT
42 (the last one is the "magic" of unprepped disk clusters)*/
43 int dsize; /* size of a prepped disk cluster */
44 int ncount; /* count of nodes occupied by a disk cluster */
47 struct cut_list;
49 /* plugin->item.b.* */
50 int can_contain_key_ctail(const coord_t *, const reiser4_key *,
51 const reiser4_item_data *);
52 int mergeable_ctail(const coord_t * p1, const coord_t * p2);
53 pos_in_node_t nr_units_ctail(const coord_t * coord);
54 int estimate_ctail(const coord_t * coord, const reiser4_item_data * data);
55 void print_ctail(const char *prefix, coord_t * coord);
56 lookup_result lookup_ctail(const reiser4_key *, lookup_bias, coord_t *);
58 int paste_ctail(coord_t * coord, reiser4_item_data * data,
59 carry_plugin_info * info UNUSED_ARG);
60 int init_ctail(coord_t *, coord_t *, reiser4_item_data *);
61 int can_shift_ctail(unsigned free_space, coord_t * coord,
62 znode * target, shift_direction pend, unsigned *size,
63 unsigned want);
64 void copy_units_ctail(coord_t * target, coord_t * source, unsigned from,
65 unsigned count, shift_direction where_is_free_space,
66 unsigned free_space);
67 int cut_units_ctail(coord_t * coord, pos_in_node_t from, pos_in_node_t to,
68 carry_cut_data *, reiser4_key * smallest_removed,
69 reiser4_key * new_first);
70 int kill_units_ctail(coord_t * coord, pos_in_node_t from, pos_in_node_t to,
71 carry_kill_data *, reiser4_key * smallest_removed,
72 reiser4_key * new_first);
73 int ctail_ok(const coord_t * coord);
74 int check_ctail(const coord_t * coord, const char **error);
76 /* plugin->u.item.s.* */
77 int read_ctail(struct file *, flow_t *, hint_t *);
78 int readpage_ctail(void *, struct page *);
79 int readpages_ctail(struct file *, struct address_space *, struct list_head *);
80 reiser4_key *append_key_ctail(const coord_t *, reiser4_key *);
81 int create_hook_ctail(const coord_t * coord, void *arg);
82 int kill_hook_ctail(const coord_t *, pos_in_node_t, pos_in_node_t,
83 carry_kill_data *);
84 int shift_hook_ctail(const coord_t *, unsigned, unsigned, znode *);
86 /* plugin->u.item.f */
87 int utmost_child_ctail(const coord_t *, sideof, jnode **);
88 int scan_ctail(flush_scan *);
89 int convert_ctail(flush_pos_t *);
90 size_t inode_scaled_cluster_size(struct inode *);
92 #endif /* __FS_REISER4_CTAIL_H__ */
94 /* Make Linus happy.
95 Local variables:
96 c-indentation-style: "K&R"
97 mode-name: "LC"
98 c-basic-offset: 8
99 tab-width: 8
100 fill-column: 120
101 End: