On Tue, Nov 06, 2007 at 02:33:53AM -0800, akpm@linux-foundation.org wrote:
[mmotm.git] / fs / reiser4 / plugin / cluster.c
blobf54b19ea6887465a69a57ec96c9a5df499c86590
1 /* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
2 * reiser4/README */
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"
9 #include "plugin.h"
10 #include "../inode.h"
12 static int change_cluster(struct inode *inode,
13 reiser4_plugin * plugin,
14 pset_member memb)
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)
28 return 0;
30 return aset_set_unsafe(&reiser4_inode_data(inode)->pset,
31 PSET_CLUSTER, plugin);
34 static reiser4_plugin_ops cluster_plugin_ops = {
35 .init = NULL,
36 .load = NULL,
37 .save_len = NULL,
38 .save = NULL,
39 .change = &change_cluster
42 #define SUPPORT_CLUSTER(SHIFT, ID, LABEL, DESC) \
43 [CLUSTER_ ## ID ## _ID] = { \
44 .h = { \
45 .type_id = REISER4_CLUSTER_PLUGIN_TYPE, \
46 .id = CLUSTER_ ## ID ## _ID, \
47 .pops = &cluster_plugin_ops, \
48 .label = LABEL, \
49 .desc = DESC, \
50 .linkage = {NULL, NULL} \
51 }, \
52 .shift = SHIFT \
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")
64 Local variables:
65 c-indentation-style: "K&R"
66 mode-name: "LC"
67 c-basic-offset: 8
68 tab-width: 8
69 fill-column: 120
70 scroll-step: 1
71 End: