1 /* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
4 /* Formatting policy plugins */
7 * Formatting policy plugin is used by object plugin (of regular file) to
8 * convert file between two representations.
10 * Currently following policies are implemented:
11 * never store file in formatted nodes
12 * always store file in formatted nodes
13 * store file in formatted nodes if file is smaller than 4 blocks (default)
21 #include "node/node.h"
22 #include "plugin_header.h"
24 #include <linux/pagemap.h>
25 #include <linux/fs.h> /* For struct inode */
28 * have_formatting_never -
34 /* Never store file's tail as direct item */
35 /* Audited by: green(2002.06.12) */
36 static int have_formatting_never(const struct inode
*inode UNUSED_ARG
37 /* inode to operate on */ ,
38 loff_t size UNUSED_ARG
/* new object size */ )
43 /* Always store file's tail as direct item */
44 /* Audited by: green(2002.06.12) */
46 have_formatting_always(const struct inode
*inode UNUSED_ARG
47 /* inode to operate on */ ,
48 loff_t size UNUSED_ARG
/* new object size */ )
53 /* This function makes test if we should store file denoted @inode as tails only or
56 have_formatting_default(const struct inode
*inode UNUSED_ARG
57 /* inode to operate on */ ,
58 loff_t size
/* new object size */ )
60 assert("umka-1253", inode
!= NULL
);
62 if (size
> inode
->i_sb
->s_blocksize
* 4)
69 formatting_plugin formatting_plugins
[LAST_TAIL_FORMATTING_ID
] = {
70 [NEVER_TAILS_FORMATTING_ID
] = {
72 .type_id
= REISER4_FORMATTING_PLUGIN_TYPE
,
73 .id
= NEVER_TAILS_FORMATTING_ID
,
76 .desc
= "Never store file's tail",
77 .linkage
= {NULL
, NULL
}
79 .have_tail
= have_formatting_never
81 [ALWAYS_TAILS_FORMATTING_ID
] = {
83 .type_id
= REISER4_FORMATTING_PLUGIN_TYPE
,
84 .id
= ALWAYS_TAILS_FORMATTING_ID
,
87 .desc
= "Always store file's tail",
88 .linkage
= {NULL
, NULL
}
90 .have_tail
= have_formatting_always
92 [SMALL_FILE_FORMATTING_ID
] = {
94 .type_id
= REISER4_FORMATTING_PLUGIN_TYPE
,
95 .id
= SMALL_FILE_FORMATTING_ID
,
98 .desc
= "store files shorter than 4 blocks in tail items",
99 .linkage
= {NULL
, NULL
}
101 .have_tail
= have_formatting_default
107 * c-indentation-style: "K&R"