ceph: replace CURRENT_TIME by current_fs_time()
authorDeepa Dinamani <deepa.kernel@gmail.com>
Wed, 3 Feb 2016 06:07:48 +0000 (22:07 -0800)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 25 Mar 2016 17:51:52 +0000 (18:51 +0100)
CURRENT_TIME macro is not appropriate for filesystems as it
doesn't use the right granularity for filesystem timestamps.
Use current_fs_time() instead.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Signed-off-by: Yan, Zheng <zyan@redhat.com>
fs/ceph/file.c
fs/ceph/inode.c
fs/ceph/mds_client.c
fs/ceph/xattr.c

index 6738766f0c12d30b7c0abdd0df71d37f01e09edd..389adacbc71935f2aa38e417fbc8ea7c40970126 100644 (file)
@@ -782,7 +782,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
        int num_pages = 0;
        int flags;
        int ret;
-       struct timespec mtime = CURRENT_TIME;
+       struct timespec mtime = current_fs_time(inode->i_sb);
        size_t count = iov_iter_count(iter);
        loff_t pos = iocb->ki_pos;
        bool write = iov_iter_rw(iter) == WRITE;
@@ -986,7 +986,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
        int flags;
        int check_caps = 0;
        int ret;
-       struct timespec mtime = CURRENT_TIME;
+       struct timespec mtime = current_fs_time(inode->i_sb);
        size_t count = iov_iter_count(from);
 
        if (ceph_snap(file_inode(file)) != CEPH_NOSNAP)
index e48fd8b2325701acb6be66c72a119e20df000ba6..cec68a6e20df4e504d78c7c0edef1744cac2e8b7 100644 (file)
@@ -1950,7 +1950,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
        if (dirtied) {
                inode_dirty_flags = __ceph_mark_dirty_caps(ci, dirtied,
                                                           &prealloc_cf);
-               inode->i_ctime = CURRENT_TIME;
+               inode->i_ctime = current_fs_time(inode->i_sb);
        }
 
        release &= issued;
index b43399d22e23ec7c49eda6d7e8d211614d38072a..aa43dcb5f9b95af6d76f488f57c47363f56e939b 100644 (file)
@@ -1729,7 +1729,7 @@ ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode)
        init_completion(&req->r_safe_completion);
        INIT_LIST_HEAD(&req->r_unsafe_item);
 
-       req->r_stamp = CURRENT_TIME;
+       req->r_stamp = current_fs_time(mdsc->fsc->sb);
 
        req->r_op = op;
        req->r_direct_mode = mode;
index 819163d8313bb3748765b5c3313dfdfd32ac9472..1e1c00a6d907f56c5f412a653ae30abe2a537230 100644 (file)
@@ -999,7 +999,7 @@ retry:
                dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL,
                                               &prealloc_cf);
                ci->i_xattrs.dirty = true;
-               inode->i_ctime = CURRENT_TIME;
+               inode->i_ctime = current_fs_time(inode->i_sb);
        }
 
        spin_unlock(&ci->i_ceph_lock);
@@ -1136,7 +1136,7 @@ retry:
        dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL,
                                       &prealloc_cf);
        ci->i_xattrs.dirty = true;
-       inode->i_ctime = CURRENT_TIME;
+       inode->i_ctime = current_fs_time(inode->i_sb);
        spin_unlock(&ci->i_ceph_lock);
        if (lock_snap_rwsem)
                up_read(&mdsc->snap_rwsem);