Skip to content

Commit bb6e0eb

Browse files
goyalbhumikadchinner
authored andcommitted
fs: xfs: xfs_icreate_item: constify xfs_item_ops structure
Declare the structure xfs_item_ops as const as it is only passed as an argument to the function xfs_log_item_init. As this argument is of type const struct xfs_item_ops *, so xfs_item_ops structures having this property can be declared as const. Done using Coccinelle: @r1 disable optional_qualifier @ identifier i; position p; @@ static struct xfs_item_ops i@p = {...}; @ok1@ identifier r1.i; position p; expression e1,e2,e3; @@ xfs_log_item_init(e1,e2,e3,&i@p) @bad@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @Depends on !bad disable optional_qualifier@ identifier r1.i; @@ static +const struct xfs_item_ops i={...}; @Depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct xfs_item_ops i; File size before: text data bss dec hex filename 737 64 8 809 329 fs/xfs/xfs_icreate_item.o File size after: text data bss dec hex filename 801 0 8 809 329 fs/xfs/xfs_icreate_item.o Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
1 parent fd26a88 commit bb6e0eb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/xfs/xfs_icreate_item.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ xfs_icreate_item_committing(
133133
/*
134134
* This is the ops vector shared by all buf log items.
135135
*/
136-
static struct xfs_item_ops xfs_icreate_item_ops = {
136+
static const struct xfs_item_ops xfs_icreate_item_ops = {
137137
.iop_size = xfs_icreate_item_size,
138138
.iop_format = xfs_icreate_item_format,
139139
.iop_pin = xfs_icreate_item_pin,

0 commit comments

Comments
 (0)