ocfs2: constify ocfs2_extent_tree_operations structures
authorJulia Lawall <Julia.Lawall@lip6.fr>
Thu, 14 Jan 2016 23:17:21 +0000 (15:17 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 15 Jan 2016 00:00:49 +0000 (16:00 -0800)
The ocfs2_extent_tree_operations structures are never modified, so
declare them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ocfs2/alloc.c
fs/ocfs2/alloc.h

index 86181d6526dc55de22b8e118660fba86546ae340..2a0aeb77ec4250fa2c074ca68d7cf1cec2b03002 100644 (file)
@@ -164,7 +164,7 @@ static int ocfs2_dinode_insert_check(struct ocfs2_extent_tree *et,
                                     struct ocfs2_extent_rec *rec);
 static int ocfs2_dinode_sanity_check(struct ocfs2_extent_tree *et);
 static void ocfs2_dinode_fill_root_el(struct ocfs2_extent_tree *et);
-static struct ocfs2_extent_tree_operations ocfs2_dinode_et_ops = {
+static const struct ocfs2_extent_tree_operations ocfs2_dinode_et_ops = {
        .eo_set_last_eb_blk     = ocfs2_dinode_set_last_eb_blk,
        .eo_get_last_eb_blk     = ocfs2_dinode_get_last_eb_blk,
        .eo_update_clusters     = ocfs2_dinode_update_clusters,
@@ -286,7 +286,7 @@ static void ocfs2_xattr_value_update_clusters(struct ocfs2_extent_tree *et,
        le32_add_cpu(&vb->vb_xv->xr_clusters, clusters);
 }
 
-static struct ocfs2_extent_tree_operations ocfs2_xattr_value_et_ops = {
+static const struct ocfs2_extent_tree_operations ocfs2_xattr_value_et_ops = {
        .eo_set_last_eb_blk     = ocfs2_xattr_value_set_last_eb_blk,
        .eo_get_last_eb_blk     = ocfs2_xattr_value_get_last_eb_blk,
        .eo_update_clusters     = ocfs2_xattr_value_update_clusters,
@@ -332,7 +332,7 @@ static void ocfs2_xattr_tree_update_clusters(struct ocfs2_extent_tree *et,
        le32_add_cpu(&xb->xb_attrs.xb_root.xt_clusters, clusters);
 }
 
-static struct ocfs2_extent_tree_operations ocfs2_xattr_tree_et_ops = {
+static const struct ocfs2_extent_tree_operations ocfs2_xattr_tree_et_ops = {
        .eo_set_last_eb_blk     = ocfs2_xattr_tree_set_last_eb_blk,
        .eo_get_last_eb_blk     = ocfs2_xattr_tree_get_last_eb_blk,
        .eo_update_clusters     = ocfs2_xattr_tree_update_clusters,
@@ -379,7 +379,7 @@ static void ocfs2_dx_root_fill_root_el(struct ocfs2_extent_tree *et)
        et->et_root_el = &dx_root->dr_list;
 }
 
-static struct ocfs2_extent_tree_operations ocfs2_dx_root_et_ops = {
+static const struct ocfs2_extent_tree_operations ocfs2_dx_root_et_ops = {
        .eo_set_last_eb_blk     = ocfs2_dx_root_set_last_eb_blk,
        .eo_get_last_eb_blk     = ocfs2_dx_root_get_last_eb_blk,
        .eo_update_clusters     = ocfs2_dx_root_update_clusters,
@@ -425,7 +425,7 @@ ocfs2_refcount_tree_extent_contig(struct ocfs2_extent_tree *et,
        return CONTIG_NONE;
 }
 
-static struct ocfs2_extent_tree_operations ocfs2_refcount_tree_et_ops = {
+static const struct ocfs2_extent_tree_operations ocfs2_refcount_tree_et_ops = {
        .eo_set_last_eb_blk     = ocfs2_refcount_tree_set_last_eb_blk,
        .eo_get_last_eb_blk     = ocfs2_refcount_tree_get_last_eb_blk,
        .eo_update_clusters     = ocfs2_refcount_tree_update_clusters,
@@ -438,7 +438,7 @@ static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et,
                                     struct buffer_head *bh,
                                     ocfs2_journal_access_func access,
                                     void *obj,
-                                    struct ocfs2_extent_tree_operations *ops)
+                                    const struct ocfs2_extent_tree_operations *ops)
 {
        et->et_ops = ops;
        et->et_root_bh = bh;
index fb09b97db162d802e6dbedc495d595a1eee23315..f3dc1b0dfffc840044d588eaead5a496129fb66b 100644 (file)
@@ -54,7 +54,7 @@
  */
 struct ocfs2_extent_tree_operations;
 struct ocfs2_extent_tree {
-       struct ocfs2_extent_tree_operations     *et_ops;
+       const struct ocfs2_extent_tree_operations *et_ops;
        struct buffer_head                      *et_root_bh;
        struct ocfs2_extent_list                *et_root_el;
        struct ocfs2_caching_info               *et_ci;