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