revert-mm-fix-blkdev-size-calculation-in-generic_write_checks
[linux-2.6/linux-trees-mm.git] / fs / reiser4 / plugin / cluster.c
blobb400d5fc0ca14f7e7d786c5bc42783bbdfb34700
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"
8 #include "plugin.h"
9 #include "../inode.h"
11 static int change_cluster(struct inode *inode,
12 reiser4_plugin * plugin,
13 pset_member memb)
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)
27 return 0;
29 return aset_set_unsafe(&reiser4_inode_data(inode)->pset,
30 PSET_CLUSTER, plugin);
33 static reiser4_plugin_ops cluster_plugin_ops = {
34 .init = NULL,
35 .load = NULL,
36 .save_len = NULL,
37 .save = NULL,
38 .change = &change_cluster
41 #define SUPPORT_CLUSTER(SHIFT, ID, LABEL, DESC) \
42 [CLUSTER_ ## ID ## _ID] = { \
43 .h = { \
44 .type_id = REISER4_CLUSTER_PLUGIN_TYPE, \
45 .id = CLUSTER_ ## ID ## _ID, \
46 .pops = &cluster_plugin_ops, \
47 .label = LABEL, \
48 .desc = DESC, \
49 .linkage = {NULL, NULL} \
50 }, \
51 .shift = SHIFT \
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")
63 Local variables:
64 c-indentation-style: "K&R"
65 mode-name: "LC"
66 c-basic-offset: 8
67 tab-width: 8
68 fill-column: 120
69 scroll-step: 1
70 End: