Merge tag 'gic-fixes-for-4.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[cascardo/linux.git] / fs / gfs2 / dir.c
index fcb59b2..3cdde5f 100644 (file)
@@ -135,7 +135,7 @@ static int gfs2_dir_write_stuffed(struct gfs2_inode *ip, const char *buf,
        memcpy(dibh->b_data + offset + sizeof(struct gfs2_dinode), buf, size);
        if (ip->i_inode.i_size < offset + size)
                i_size_write(&ip->i_inode, offset + size);
-       ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
+       ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
        gfs2_dinode_out(ip, dibh->b_data);
 
        brelse(dibh);
@@ -233,7 +233,7 @@ out:
 
        if (ip->i_inode.i_size < offset + copied)
                i_size_write(&ip->i_inode, offset + copied);
-       ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
+       ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
 
        gfs2_trans_add_meta(ip->i_gl, dibh);
        gfs2_dinode_out(ip, dibh->b_data);
@@ -351,7 +351,7 @@ static __be64 *gfs2_dir_get_hash_table(struct gfs2_inode *ip)
        if (hc)
                return hc;
 
-       hsize = 1 << ip->i_depth;
+       hsize = BIT(ip->i_depth);
        hsize *= sizeof(__be64);
        if (hsize != i_size_read(&ip->i_inode)) {
                gfs2_consist_inode(ip);
@@ -819,8 +819,8 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
 
        if (ip->i_diskflags & GFS2_DIF_EXHASH) {
                struct gfs2_leaf *leaf;
-               unsigned hsize = 1 << ip->i_depth;
-               unsigned index;
+               unsigned int hsize = BIT(ip->i_depth);
+               unsigned int index;
                u64 ln;
                if (hsize * sizeof(u64) != i_size_read(inode)) {
                        gfs2_consist_inode(ip);
@@ -872,7 +872,7 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh,
        struct gfs2_leaf *leaf;
        struct gfs2_dirent *dent;
        struct qstr name = { .name = "" };
-       struct timespec tv = CURRENT_TIME;
+       struct timespec tv = current_time(inode);
 
        error = gfs2_alloc_blocks(ip, &bn, &n, 0, NULL);
        if (error)
@@ -932,7 +932,7 @@ static int dir_make_exhash(struct inode *inode)
                return -ENOSPC;
        bn = bh->b_blocknr;
 
-       gfs2_assert(sdp, dip->i_entries < (1 << 16));
+       gfs2_assert(sdp, dip->i_entries < BIT(16));
        leaf->lf_entries = cpu_to_be16(dip->i_entries);
 
        /*  Copy dirents  */
@@ -1041,7 +1041,7 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
        bn = nbh->b_blocknr;
 
        /*  Compute the start and len of leaf pointers in the hash table.  */
-       len = 1 << (dip->i_depth - be16_to_cpu(oleaf->lf_depth));
+       len = BIT(dip->i_depth - be16_to_cpu(oleaf->lf_depth));
        half_len = len >> 1;
        if (!half_len) {
                pr_warn("i_depth %u lf_depth %u index %u\n",
@@ -1163,7 +1163,7 @@ static int dir_double_exhash(struct gfs2_inode *dip)
        int x;
        int error = 0;
 
-       hsize = 1 << dip->i_depth;
+       hsize = BIT(dip->i_depth);
        hsize_bytes = hsize * sizeof(__be64);
 
        hc = gfs2_dir_get_hash_table(dip);
@@ -1539,7 +1539,7 @@ static int dir_e_read(struct inode *inode, struct dir_context *ctx,
        int error = 0;
        unsigned depth = 0;
 
-       hsize = 1 << dip->i_depth;
+       hsize = BIT(dip->i_depth);
        hash = gfs2_dir_offset2hash(ctx->pos);
        index = hash >> (32 - dip->i_depth);
 
@@ -1558,7 +1558,7 @@ static int dir_e_read(struct inode *inode, struct dir_context *ctx,
                if (error)
                        break;
 
-               len = 1 << (dip->i_depth - depth);
+               len = BIT(dip->i_depth - depth);
                index = (index & ~(len - 1)) + len;
        }
 
@@ -1816,7 +1816,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
                        gfs2_inum_out(nip, dent);
                        dent->de_type = cpu_to_be16(IF2DT(nip->i_inode.i_mode));
                        dent->de_rahead = cpu_to_be16(gfs2_inode_ra_len(nip));
-                       tv = CURRENT_TIME;
+                       tv = current_time(&ip->i_inode);
                        if (ip->i_diskflags & GFS2_DIF_EXHASH) {
                                leaf = (struct gfs2_leaf *)bh->b_data;
                                be16_add_cpu(&leaf->lf_entries, 1);
@@ -1878,7 +1878,7 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct dentry *dentry)
        const struct qstr *name = &dentry->d_name;
        struct gfs2_dirent *dent, *prev = NULL;
        struct buffer_head *bh;
-       struct timespec tv = CURRENT_TIME;
+       struct timespec tv = current_time(&dip->i_inode);
 
        /* Returns _either_ the entry (if its first in block) or the
           previous entry otherwise */
@@ -1960,7 +1960,7 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
                gfs2_trans_add_meta(dip->i_gl, bh);
        }
 
-       dip->i_inode.i_mtime = dip->i_inode.i_ctime = CURRENT_TIME;
+       dip->i_inode.i_mtime = dip->i_inode.i_ctime = current_time(&dip->i_inode);
        gfs2_dinode_out(dip, bh->b_data);
        brelse(bh);
        return 0;
@@ -2113,7 +2113,7 @@ int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip)
        u64 leaf_no;
        int error = 0, last;
 
-       hsize = 1 << dip->i_depth;
+       hsize = BIT(dip->i_depth);
 
        lp = gfs2_dir_get_hash_table(dip);
        if (IS_ERR(lp))
@@ -2126,7 +2126,7 @@ int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip)
                        if (error)
                                goto out;
                        leaf = (struct gfs2_leaf *)bh->b_data;
-                       len = 1 << (dip->i_depth - be16_to_cpu(leaf->lf_depth));
+                       len = BIT(dip->i_depth - be16_to_cpu(leaf->lf_depth));
 
                        next_index = (index & ~(len - 1)) + len;
                        last = ((next_index >= hsize) ? 1 : 0);