aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/dir.c
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2016-08-02 13:05:27 -0400
committerBob Peterson <rpeterso@redhat.com>2016-08-02 13:05:27 -0400
commit47a9a527946842dd8d83d4c8c8be22b2615b65f5 (patch)
tree1c244821bac1286dcedc72f09d4d2d9fa343176d /fs/gfs2/dir.c
parent731c7d3a205ba89b475b2aa71b5f13dd6ae3de56 (diff)
GFS2: use BIT() macro
Replace 1 << value shift by more explicit BIT() macro Also fixes two bare unsigned definitions: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' + unsigned hsize = BIT(ip->i_depth); Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'fs/gfs2/dir.c')
-rw-r--r--fs/gfs2/dir.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index fcb59b23f1e3..db8fbeb62483 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -351,7 +351,7 @@ static __be64 *gfs2_dir_get_hash_table(struct gfs2_inode *ip)
351 if (hc) 351 if (hc)
352 return hc; 352 return hc;
353 353
354 hsize = 1 << ip->i_depth; 354 hsize = BIT(ip->i_depth);
355 hsize *= sizeof(__be64); 355 hsize *= sizeof(__be64);
356 if (hsize != i_size_read(&ip->i_inode)) { 356 if (hsize != i_size_read(&ip->i_inode)) {
357 gfs2_consist_inode(ip); 357 gfs2_consist_inode(ip);
@@ -819,8 +819,8 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
819 819
820 if (ip->i_diskflags & GFS2_DIF_EXHASH) { 820 if (ip->i_diskflags & GFS2_DIF_EXHASH) {
821 struct gfs2_leaf *leaf; 821 struct gfs2_leaf *leaf;
822 unsigned hsize = 1 << ip->i_depth; 822 unsigned int hsize = BIT(ip->i_depth);
823 unsigned index; 823 unsigned int index;
824 u64 ln; 824 u64 ln;
825 if (hsize * sizeof(u64) != i_size_read(inode)) { 825 if (hsize * sizeof(u64) != i_size_read(inode)) {
826 gfs2_consist_inode(ip); 826 gfs2_consist_inode(ip);
@@ -932,7 +932,7 @@ static int dir_make_exhash(struct inode *inode)
932 return -ENOSPC; 932 return -ENOSPC;
933 bn = bh->b_blocknr; 933 bn = bh->b_blocknr;
934 934
935 gfs2_assert(sdp, dip->i_entries < (1 << 16)); 935 gfs2_assert(sdp, dip->i_entries < BIT(16));
936 leaf->lf_entries = cpu_to_be16(dip->i_entries); 936 leaf->lf_entries = cpu_to_be16(dip->i_entries);
937 937
938 /* Copy dirents */ 938 /* Copy dirents */
@@ -1041,7 +1041,7 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
1041 bn = nbh->b_blocknr; 1041 bn = nbh->b_blocknr;
1042 1042
1043 /* Compute the start and len of leaf pointers in the hash table. */ 1043 /* Compute the start and len of leaf pointers in the hash table. */
1044 len = 1 << (dip->i_depth - be16_to_cpu(oleaf->lf_depth)); 1044 len = BIT(dip->i_depth - be16_to_cpu(oleaf->lf_depth));
1045 half_len = len >> 1; 1045 half_len = len >> 1;
1046 if (!half_len) { 1046 if (!half_len) {
1047 pr_warn("i_depth %u lf_depth %u index %u\n", 1047 pr_warn("i_depth %u lf_depth %u index %u\n",
@@ -1163,7 +1163,7 @@ static int dir_double_exhash(struct gfs2_inode *dip)
1163 int x; 1163 int x;
1164 int error = 0; 1164 int error = 0;
1165 1165
1166 hsize = 1 << dip->i_depth; 1166 hsize = BIT(dip->i_depth);
1167 hsize_bytes = hsize * sizeof(__be64); 1167 hsize_bytes = hsize * sizeof(__be64);
1168 1168
1169 hc = gfs2_dir_get_hash_table(dip); 1169 hc = gfs2_dir_get_hash_table(dip);
@@ -1539,7 +1539,7 @@ static int dir_e_read(struct inode *inode, struct dir_context *ctx,
1539 int error = 0; 1539 int error = 0;
1540 unsigned depth = 0; 1540 unsigned depth = 0;
1541 1541
1542 hsize = 1 << dip->i_depth; 1542 hsize = BIT(dip->i_depth);
1543 hash = gfs2_dir_offset2hash(ctx->pos); 1543 hash = gfs2_dir_offset2hash(ctx->pos);
1544 index = hash >> (32 - dip->i_depth); 1544 index = hash >> (32 - dip->i_depth);
1545 1545
@@ -1558,7 +1558,7 @@ static int dir_e_read(struct inode *inode, struct dir_context *ctx,
1558 if (error) 1558 if (error)
1559 break; 1559 break;
1560 1560
1561 len = 1 << (dip->i_depth - depth); 1561 len = BIT(dip->i_depth - depth);
1562 index = (index & ~(len - 1)) + len; 1562 index = (index & ~(len - 1)) + len;
1563 } 1563 }
1564 1564
@@ -2113,7 +2113,7 @@ int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip)
2113 u64 leaf_no; 2113 u64 leaf_no;
2114 int error = 0, last; 2114 int error = 0, last;
2115 2115
2116 hsize = 1 << dip->i_depth; 2116 hsize = BIT(dip->i_depth);
2117 2117
2118 lp = gfs2_dir_get_hash_table(dip); 2118 lp = gfs2_dir_get_hash_table(dip);
2119 if (IS_ERR(lp)) 2119 if (IS_ERR(lp))
@@ -2126,7 +2126,7 @@ int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip)
2126 if (error) 2126 if (error)
2127 goto out; 2127 goto out;
2128 leaf = (struct gfs2_leaf *)bh->b_data; 2128 leaf = (struct gfs2_leaf *)bh->b_data;
2129 len = 1 << (dip->i_depth - be16_to_cpu(leaf->lf_depth)); 2129 len = BIT(dip->i_depth - be16_to_cpu(leaf->lf_depth));
2130 2130
2131 next_index = (index & ~(len - 1)) + len; 2131 next_index = (index & ~(len - 1)) + len;
2132 last = ((next_index >= hsize) ? 1 : 0); 2132 last = ((next_index >= hsize) ? 1 : 0);