current_fs_time() uses struct super_block* as an argument.
As per Linus's suggestion, this is changed to take struct
inode* as a parameter instead. This is because the function
is primarily meant for vfs inode timestamps.
Also the function was renamed as per Arnd's suggestion.
Change all calls to current_fs_time() to use the new
current_time() function instead. current_fs_time() will be
deleted.
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
 
        if (ret > 0) {
                struct inode *inode = file_inode(file);
-               inode->i_atime = current_fs_time(inode->i_sb);
+               inode->i_atime = current_time(inode);
        }
 
        return ret;
 
 
        if (ret > 0) {
                struct inode *inode = file_inode(file);
-               inode->i_atime = current_fs_time(inode->i_sb);
+               inode->i_atime = current_time(inode);
        }
 
        return ret;
 
                        inode->i_flags &= ~S_NOSEC;
        }
 
-       now = current_fs_time(inode->i_sb);
+       now = current_time(inode);
 
        attr->ia_ctime = now;
        if (!(ia_valid & ATTR_ATIME_SET))
 
 
        inode->i_mode = S_IFREG;
        inode->i_atime = inode->i_mtime = inode->i_ctime =
-               current_fs_time(inode->i_sb);
+               current_time(inode);
        inode->i_op = &bad_inode_ops;   
        inode->i_fop = &bad_file_ops;   
 }
 
                inode->i_ino = get_next_ino();
                inode->i_mode = mode;
                inode->i_atime = inode->i_mtime = inode->i_ctime =
-                       current_fs_time(inode->i_sb);
+                       current_time(inode);
        }
        return inode;
 }
 
        if (IS_NOCMTIME(inode))
                return;
 
-       now = current_fs_time(inode->i_sb);
+       now = current_time(inode);
        if (!timespec_equal(&inode->i_mtime, &now))
                inode->i_mtime = now;
 
                goto out_free;
 
        inode_inc_iversion(inode);
-       inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
+       inode->i_mtime = inode->i_ctime = current_time(inode);
 
        trans->block_rsv = &root->fs_info->trans_block_rsv;
        ret = btrfs_update_inode(trans, root, inode);
                if (IS_ERR(trans)) {
                        ret = PTR_ERR(trans);
                } else {
-                       inode->i_ctime = current_fs_time(inode->i_sb);
+                       inode->i_ctime = current_time(inode);
                        i_size_write(inode, actual_end);
                        btrfs_ordered_update_i_size(inode, actual_end, NULL);
                        ret = btrfs_update_inode(trans, root, inode);
 
        inode_inc_iversion(inode);
        inode_inc_iversion(dir);
        inode->i_ctime = dir->i_mtime =
-               dir->i_ctime = current_fs_time(inode->i_sb);
+               dir->i_ctime = current_time(inode);
        ret = btrfs_update_inode(trans, root, dir);
 out:
        return ret;
 
        btrfs_i_size_write(dir, dir->i_size - name_len * 2);
        inode_inc_iversion(dir);
-       dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
+       dir->i_mtime = dir->i_ctime = current_time(dir);
        ret = btrfs_update_inode_fallback(trans, root, dir);
        if (ret)
                btrfs_abort_transaction(trans, ret);
                inode_inc_iversion(inode);
                if (!(mask & (ATTR_CTIME | ATTR_MTIME)))
                        inode->i_ctime = inode->i_mtime =
-                               current_fs_time(inode->i_sb);
+                               current_time(inode);
        }
 
        if (newsize > oldsize) {
        inode->i_op = &btrfs_dir_ro_inode_operations;
        inode->i_fop = &simple_dir_operations;
        inode->i_mode = S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO;
-       inode->i_mtime = current_fs_time(inode->i_sb);
+       inode->i_mtime = current_time(inode);
        inode->i_atime = inode->i_mtime;
        inode->i_ctime = inode->i_mtime;
        BTRFS_I(inode)->i_otime = inode->i_mtime;
        inode_init_owner(inode, dir, mode);
        inode_set_bytes(inode, 0);
 
-       inode->i_mtime = current_fs_time(inode->i_sb);
+       inode->i_mtime = current_time(inode);
        inode->i_atime = inode->i_mtime;
        inode->i_ctime = inode->i_mtime;
        BTRFS_I(inode)->i_otime = inode->i_mtime;
                           name_len * 2);
        inode_inc_iversion(parent_inode);
        parent_inode->i_mtime = parent_inode->i_ctime =
-               current_fs_time(parent_inode->i_sb);
+               current_time(parent_inode);
        ret = btrfs_update_inode(trans, root, parent_inode);
        if (ret)
                btrfs_abort_transaction(trans, ret);
        BTRFS_I(inode)->dir_index = 0ULL;
        inc_nlink(inode);
        inode_inc_iversion(inode);
-       inode->i_ctime = current_fs_time(inode->i_sb);
+       inode->i_ctime = current_time(inode);
        ihold(inode);
        set_bit(BTRFS_INODE_COPY_EVERYTHING, &BTRFS_I(inode)->runtime_flags);
 
        struct btrfs_root *dest = BTRFS_I(new_dir)->root;
        struct inode *new_inode = new_dentry->d_inode;
        struct inode *old_inode = old_dentry->d_inode;
-       struct timespec ctime = CURRENT_TIME;
+       struct timespec ctime = current_time(old_inode);
        struct dentry *parent;
        u64 old_ino = btrfs_ino(old_inode);
        u64 new_ino = btrfs_ino(new_inode);
        inode_inc_iversion(old_inode);
        old_dir->i_ctime = old_dir->i_mtime =
        new_dir->i_ctime = new_dir->i_mtime =
-       old_inode->i_ctime = current_fs_time(old_dir->i_sb);
+       old_inode->i_ctime = current_time(old_dir);
 
        if (old_dentry->d_parent != new_dentry->d_parent)
                btrfs_record_unlink_dir(trans, old_dir, old_inode, 1);
 
        if (new_inode) {
                inode_inc_iversion(new_inode);
-               new_inode->i_ctime = current_fs_time(new_inode->i_sb);
+               new_inode->i_ctime = current_time(new_inode);
                if (unlikely(btrfs_ino(new_inode) ==
                             BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) {
                        root_objectid = BTRFS_I(new_inode)->location.objectid;
                *alloc_hint = ins.objectid + ins.offset;
 
                inode_inc_iversion(inode);
-               inode->i_ctime = current_fs_time(inode->i_sb);
+               inode->i_ctime = current_time(inode);
                BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC;
                if (!(mode & FALLOC_FL_KEEP_SIZE) &&
                    (actual_len > inode->i_size) &&
 
 
        btrfs_update_iflags(inode);
        inode_inc_iversion(inode);
-       inode->i_ctime = current_fs_time(inode->i_sb);
+       inode->i_ctime = current_time(inode);
        ret = btrfs_update_inode(trans, root, inode);
 
        btrfs_end_transaction(trans, root);
        struct btrfs_root *root = BTRFS_I(dir)->root;
        struct btrfs_root *new_root;
        struct btrfs_block_rsv block_rsv;
-       struct timespec cur_time = current_fs_time(dir->i_sb);
+       struct timespec cur_time = current_time(dir);
        struct inode *inode;
        int ret;
        int err;
 
        inode_inc_iversion(inode);
        if (!no_time_update)
-               inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
+               inode->i_mtime = inode->i_ctime = current_time(inode);
        /*
         * We round up to the block size at eof when determining which
         * extents to clone above, but shouldn't round up the file size.
        struct btrfs_root *root = BTRFS_I(inode)->root;
        struct btrfs_root_item *root_item = &root->root_item;
        struct btrfs_trans_handle *trans;
-       struct timespec ct = current_fs_time(inode->i_sb);
+       struct timespec ct = current_time(inode);
        int ret = 0;
        int received_uuid_changed;
 
 
        parent_root = BTRFS_I(parent_inode)->root;
        record_root_in_trans(trans, parent_root, 0);
 
-       cur_time = current_fs_time(parent_inode->i_sb);
+       cur_time = current_time(parent_inode);
 
        /*
         * insert the directory item
        btrfs_i_size_write(parent_inode, parent_inode->i_size +
                                         dentry->d_name.len * 2);
        parent_inode->i_mtime = parent_inode->i_ctime =
-               current_fs_time(parent_inode->i_sb);
+               current_time(parent_inode);
        ret = btrfs_update_inode_fallback(trans, parent_root, parent_inode);
        if (ret) {
                btrfs_abort_transaction(trans, ret);
 
                goto out;
 
        inode_inc_iversion(inode);
-       inode->i_ctime = current_fs_time(inode->i_sb);
+       inode->i_ctime = current_time(inode);
        set_bit(BTRFS_INODE_COPY_EVERYTHING, &BTRFS_I(inode)->runtime_flags);
        ret = btrfs_update_inode(trans, root, inode);
        BUG_ON(ret);
 
        int num_pages = 0;
        int flags;
        int ret;
-       struct timespec mtime = current_fs_time(inode->i_sb);
+       struct timespec mtime = current_time(inode);
        size_t count = iov_iter_count(iter);
        loff_t pos = iocb->ki_pos;
        bool write = iov_iter_rw(iter) == WRITE;
        int flags;
        int check_caps = 0;
        int ret;
-       struct timespec mtime = current_fs_time(inode->i_sb);
+       struct timespec mtime = current_time(inode);
        size_t count = iov_iter_count(from);
 
        if (ceph_snap(file_inode(file)) != CEPH_NOSNAP)
 
        if (dirtied) {
                inode_dirty_flags = __ceph_mark_dirty_caps(ci, dirtied,
                                                           &prealloc_cf);
-               inode->i_ctime = current_fs_time(inode->i_sb);
+               inode->i_ctime = current_time(inode);
        }
 
        release &= issued;
 
                dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL,
                                               &prealloc_cf);
                ci->i_xattrs.dirty = true;
-               inode->i_ctime = current_fs_time(inode->i_sb);
+               inode->i_ctime = current_time(inode);
        }
 
        spin_unlock(&ci->i_ceph_lock);
 
                                           write_data, to - from, &offset);
                cifsFileInfo_put(open_file);
                /* Does mm or vfs already set times? */
-               inode->i_atime = inode->i_mtime = current_fs_time(inode->i_sb);
+               inode->i_atime = inode->i_mtime = current_time(inode);
                if ((bytes_written > 0) && (offset))
                        rc = 0;
                else if (bytes_written < 0)
                cifs_dbg(FYI, "Bytes read %d\n", rc);
 
        file_inode(file)->i_atime =
-               current_fs_time(file_inode(file)->i_sb);
+               current_time(file_inode(file));
 
        if (PAGE_SIZE > rc)
                memset(read_data + rc, 0, PAGE_SIZE - rc);
 
                sd_iattr->ia_uid = GLOBAL_ROOT_UID;
                sd_iattr->ia_gid = GLOBAL_ROOT_GID;
                sd_iattr->ia_atime = sd_iattr->ia_mtime =
-                       sd_iattr->ia_ctime = current_fs_time(inode->i_sb);
+                       sd_iattr->ia_ctime = current_time(inode);
                sd->s_iattr = sd_iattr;
        }
        /* attributes were changed atleast once in past */
 {
        inode->i_mode = mode;
        inode->i_atime = inode->i_mtime =
-               inode->i_ctime = current_fs_time(inode->i_sb);
+               inode->i_ctime = current_time(inode);
 }
 
 static inline void set_inode_attr(struct inode * inode, struct iattr * iattr)
                return -ENOMEM;
 
        p_inode = d_inode(dentry->d_parent);
-       p_inode->i_mtime = p_inode->i_ctime = current_fs_time(p_inode->i_sb);
+       p_inode->i_mtime = p_inode->i_ctime = current_time(p_inode);
        configfs_set_inode_lock_class(sd, inode);
 
        init(inode);
 
        if (inode) {
                inode->i_ino = get_next_ino();
                inode->i_atime = inode->i_mtime =
-                       inode->i_ctime = current_fs_time(sb);
+                       inode->i_ctime = current_time(inode);
        }
        return inode;
 }
 
 
        if (is_inode_flag_set(inode, FI_ACL_MODE)) {
                inode->i_mode = F2FS_I(inode)->i_acl_mode;
-               inode->i_ctime = CURRENT_TIME;
+               inode->i_ctime = current_time(inode);
                clear_inode_flag(inode, FI_ACL_MODE);
        }
        if (index == F2FS_XATTR_INDEX_ENCRYPTION &&
 
 
        /* Equivalent to a chmod() */
        ia.ia_valid = ATTR_MODE | ATTR_CTIME;
-       ia.ia_ctime = current_fs_time(inode->i_sb);
+       ia.ia_ctime = current_time(inode);
        if (is_dir)
                ia.ia_mode = fat_make_mode(sbi, attr, S_IRWXUGO);
        else {
 
 static inline void fuse_update_ctime(struct inode *inode)
 {
        if (!IS_NOCMTIME(inode)) {
-               inode->i_ctime = current_fs_time(inode->i_sb);
+               inode->i_ctime = current_time(inode);
                mark_inode_dirty_sync(inode);
        }
 }
 
        if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))
                return false;
 
-       now = current_fs_time(inode->i_sb);
+       now = current_time(inode);
 
        if (!relatime_need_update(mnt, inode, now))
                return false;
         * We may also fail on filesystems that have the ability to make parts
         * of the fs read only, e.g. subvolumes in Btrfs.
         */
-       now = current_fs_time(inode->i_sb);
+       now = current_time(inode);
        update_time(inode, &now, S_ATIME);
        __mnt_drop_write(mnt);
 skip_update:
        if (IS_NOCMTIME(inode))
                return 0;
 
-       now = current_fs_time(inode->i_sb);
+       now = current_time(inode);
        if (!timespec_equal(&inode->i_mtime, &now))
                sync_it = S_MTIME;
 
 
        old_ip->i_ctime = current_time(old_ip);
        mark_inode_dirty(old_ip);
 
-       new_dir->i_ctime = new_dir->i_mtime = current_fs_time(new_dir->i_sb);
+       new_dir->i_ctime = new_dir->i_mtime = current_time(new_dir);
        mark_inode_dirty(new_dir);
 
        /* Build list of inodes modified by this transaction */
 
 {
        inode->i_mode = mode;
        inode->i_atime = inode->i_mtime =
-               inode->i_ctime = current_fs_time(inode->i_sb);
+               inode->i_ctime = current_time(inode);
 }
 
 static inline void set_inode_attr(struct inode *inode, struct iattr *iattr)
 
        }
 
        if (has_lease)
-               *time = current_fs_time(inode->i_sb);
+               *time = current_time(inode);
        else
                *time = inode->i_mtime;
 }
 
 
        if (lcp->lc_mtime.tv_nsec == UTIME_NOW ||
            timespec_compare(&lcp->lc_mtime, &inode->i_mtime) < 0)
-               lcp->lc_mtime = current_fs_time(inode->i_sb);
+               lcp->lc_mtime = current_time(inode);
        iattr.ia_valid |= ATTR_ATIME | ATTR_CTIME | ATTR_MTIME;
        iattr.ia_atime = iattr.ia_ctime = iattr.ia_mtime = lcp->lc_mtime;
 
 
         * for real.
         */
        if (!IS_NOCMTIME(VFS_I(base_ni)) && !IS_RDONLY(VFS_I(base_ni))) {
-               struct timespec now = current_fs_time(VFS_I(base_ni)->i_sb);
+               struct timespec now = current_time(VFS_I(base_ni));
                int sync_it = 0;
 
                if (!timespec_equal(&VFS_I(base_ni)->i_mtime, &now) ||
 
 
                /* Set the inode times to the current time. */
                vi->i_atime = vi->i_mtime = vi->i_ctime =
-                       current_fs_time(vi->i_sb);
+                       current_time(vi);
                /*
                 * Set the file size to 0, the ntfs inode sizes are set to 0 by
                 * the call to ntfs_init_big_inode() below.
 
                     dentry->d_name.name);
 
        SetMtimeFlag(parent);
-       dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
+       dir->i_mtime = dir->i_ctime = current_time(dir);
        mark_inode_dirty_sync(dir);
        ret = 0;
 out:
                drop_nlink(inode);
 
                SetMtimeFlag(parent);
-               dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
+               dir->i_mtime = dir->i_ctime = current_time(dir);
                mark_inode_dirty_sync(dir);
        }
        return ret;
                     dentry->d_name.name);
 
        SetMtimeFlag(parent);
-       dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
+       dir->i_mtime = dir->i_ctime = current_time(dir);
        mark_inode_dirty_sync(dir);
        ret = 0;
 out:
         * across clients; keep constant at 1.
         */
        SetMtimeFlag(parent);
-       dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
+       dir->i_mtime = dir->i_ctime = current_time(dir);
        mark_inode_dirty_sync(dir);
 out:
        op_release(new_op);
                     ret);
 
        if (new_dentry->d_inode)
-               new_dentry->d_inode->i_ctime = CURRENT_TIME;
+               new_dentry->d_inode->i_ctime = current_time(new_dentry->d_inode);
 
        op_release(new_op);
        return ret;
 
        else
                iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG;
        inode->i_mtime = inode->i_atime = inode->i_ctime =
-               iinfo->i_crtime = current_fs_time(inode->i_sb);
+               iinfo->i_crtime = current_time(inode);
        if (unlikely(insert_inode_locked(inode) < 0)) {
                make_bad_inode(inode);
                iput(inode);
 
        *new = 1;
        iinfo->i_next_alloc_block = block;
        iinfo->i_next_alloc_goal = newblocknum;
-       inode->i_ctime = current_fs_time(inode->i_sb);
+       inode->i_ctime = current_time(inode);
 
        if (IS_SYNC(inode))
                udf_sync_inode(inode);
                up_write(&iinfo->i_data_sem);
        }
 update_time:
-       inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
+       inode->i_mtime = inode->i_ctime = current_time(inode);
        if (IS_SYNC(inode))
                udf_sync_inode(inode);
        else
 
        *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
                cpu_to_le32(iinfo->i_unique & 0x00000000FFFFFFFFUL);
        udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
-       dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb);
+       dir->i_ctime = dir->i_mtime = current_time(dir);
        mark_inode_dirty(dir);
        if (fibh.sbh != fibh.ebh)
                brelse(fibh.ebh);
        cfi.fileCharacteristics |= FID_FILE_CHAR_DIRECTORY;
        udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
        inc_nlink(dir);
-       dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb);
+       dir->i_ctime = dir->i_mtime = current_time(dir);
        mark_inode_dirty(dir);
        unlock_new_inode(inode);
        d_instantiate(dentry, inode);
        inode->i_size = 0;
        inode_dec_link_count(dir);
        inode->i_ctime = dir->i_ctime = dir->i_mtime =
-                                               current_fs_time(dir->i_sb);
+                                               current_time(inode);
        mark_inode_dirty(dir);
 
 end_rmdir:
        retval = udf_delete_entry(dir, fi, &fibh, &cfi);
        if (retval)
                goto end_unlink;
-       dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb);
+       dir->i_ctime = dir->i_mtime = current_time(dir);
        mark_inode_dirty(dir);
        inode_dec_link_count(inode);
        inode->i_ctime = dir->i_ctime;
                brelse(fibh.ebh);
        brelse(fibh.sbh);
        inc_nlink(inode);
-       inode->i_ctime = current_fs_time(inode->i_sb);
+       inode->i_ctime = current_time(inode);
        mark_inode_dirty(inode);
-       dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb);
+       dir->i_ctime = dir->i_mtime = current_time(dir);
        mark_inode_dirty(dir);
        ihold(inode);
        d_instantiate(dentry, inode);
         * Like most other Unix systems, set the ctime for inodes on a
         * rename.
         */
-       old_inode->i_ctime = current_fs_time(old_inode->i_sb);
+       old_inode->i_ctime = current_time(old_inode);
        mark_inode_dirty(old_inode);
 
        /*
        udf_delete_entry(old_dir, ofi, &ofibh, &ocfi);
 
        if (new_inode) {
-               new_inode->i_ctime = current_fs_time(new_inode->i_sb);
+               new_inode->i_ctime = current_time(new_inode);
                inode_dec_link_count(new_inode);
        }
-       old_dir->i_ctime = old_dir->i_mtime = current_fs_time(old_dir->i_sb);
-       new_dir->i_ctime = new_dir->i_mtime = current_fs_time(new_dir->i_sb);
+       old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir);
+       new_dir->i_ctime = new_dir->i_mtime = current_time(new_dir);
        mark_inode_dirty(old_dir);
        mark_inode_dirty(new_dir);
 
 
 
                iattr.ia_valid = ATTR_MODE | ATTR_CTIME;
                iattr.ia_mode = mode;
-               iattr.ia_ctime = current_fs_time(inode->i_sb);
+               iattr.ia_ctime = current_time(inode);
 
                error = xfs_setattr_nonsize(XFS_I(inode), &iattr, XFS_ATTR_NOACL);
        }
 
        ip->i_d.di_nextents = 0;
        ASSERT(ip->i_d.di_nblocks == 0);
 
-       tv = current_fs_time(mp->m_super);
+       tv = current_time(inode);
        inode->i_mtime = tv;
        inode->i_atime = tv;
        inode->i_ctime = tv;
 
        if (newsize != oldsize &&
            !(iattr->ia_valid & (ATTR_CTIME | ATTR_MTIME))) {
                iattr->ia_ctime = iattr->ia_mtime =
-                       current_fs_time(inode->i_sb);
+                       current_time(inode);
                iattr->ia_valid |= ATTR_CTIME | ATTR_MTIME;
        }
 
 
        ASSERT(tp);
        ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
 
-       tv = current_fs_time(inode->i_sb);
+       tv = current_time(inode);
 
        if (flags & XFS_ICHGTIME_MOD)
                inode->i_mtime = tv;