1 /* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
3 /* Contains reiser4 cluster plugins (see
4 http://www.namesys.com/cryptcompress_design.html
5 "Concepts of clustering" for details). */
7 #include "plugin_header.h"
11 static int change_cluster(struct inode
*inode
,
12 reiser4_plugin
* plugin
,
15 assert("edward-1324", inode
!= NULL
);
16 assert("edward-1325", plugin
!= NULL
);
17 assert("edward-1326", is_reiser4_inode(inode
));
18 assert("edward-1327", plugin
->h
.type_id
== REISER4_CLUSTER_PLUGIN_TYPE
);
20 /* Can't change the cluster plugin for already existent regular files. */
21 if (!plugin_of_group(inode_file_plugin(inode
), REISER4_DIRECTORY_FILE
))
22 return RETERR(-EINVAL
);
24 /* If matches, nothing to change. */
25 if (inode_hash_plugin(inode
) != NULL
&&
26 inode_hash_plugin(inode
)->h
.id
== plugin
->h
.id
)
29 return aset_set_unsafe(&reiser4_inode_data(inode
)->pset
,
30 PSET_CLUSTER
, plugin
);
33 static reiser4_plugin_ops cluster_plugin_ops
= {
38 .change
= &change_cluster
41 #define SUPPORT_CLUSTER(SHIFT, ID, LABEL, DESC) \
42 [CLUSTER_ ## ID ## _ID] = { \
44 .type_id = REISER4_CLUSTER_PLUGIN_TYPE, \
45 .id = CLUSTER_ ## ID ## _ID, \
46 .pops = &cluster_plugin_ops, \
49 .linkage = {NULL, NULL} \
54 cluster_plugin cluster_plugins
[LAST_CLUSTER_ID
] = {
55 SUPPORT_CLUSTER(16, 64K
, "64K", "Large"),
56 SUPPORT_CLUSTER(15, 32K
, "32K", "Big"),
57 SUPPORT_CLUSTER(14, 16K
, "16K", "Average"),
58 SUPPORT_CLUSTER(13, 8K
, "8K", "Small"),
59 SUPPORT_CLUSTER(12, 4K
, "4K", "Minimal")
64 c-indentation-style: "K&R"