From patchwork Fri Feb 12 09:36:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 8289421 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 506629F1C0 for ; Fri, 12 Feb 2016 09:39:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1C0ED203B7 for ; Fri, 12 Feb 2016 09:39:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E833F203C4 for ; Fri, 12 Feb 2016 09:39:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751811AbcBLJiv (ORCPT ); Fri, 12 Feb 2016 04:38:51 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:33130 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751950AbcBLJhS (ORCPT ); Fri, 12 Feb 2016 04:37:18 -0500 Received: by mail-pa0-f41.google.com with SMTP id fl4so32359220pad.0; Fri, 12 Feb 2016 01:37:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=p0/KLta+RRXso01mwRaD//WPj3ALOdqcvQhzhA1ooqQ=; b=h2LIa3NjGY3y5SnLwMZ984eoZcVTgqx/J67Ynt1OmUFVcJtRr1R/zrqXOY+FRHaNSh cIQPQXYI69NP7UCgbyLRzDKv2mdqBTFANj/V8IcuDqUpEeAC/y9seSMKJQZVh4oTw/4c TCdk19gv/oXo9ytQ3Hk8Fg7zHm7/xqHHyfaeI4Ht4LxpKTX1bPZMuPccLV9hhyoeK6eS k/zeVC/kBhbObaH12IJcixAKwq29Zsml8wbqu8RAs/Z+6Y5MvoDz5hvYUOKA8Hq1CxRX bHhxNJQl+z4psPCfTYU61ZtO9GF2Hvrw/ba+3P/YsYuNQnLcMHPuGdeYPdQBdWXWPIlJ 3bxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=p0/KLta+RRXso01mwRaD//WPj3ALOdqcvQhzhA1ooqQ=; b=kuGvcS9dS1zmB1IBD0TK8Igg8ZXj0mlrRq0wHf6XzfTyD1IzZ4TlNRrypePfQFqwpp n+Y+UPEbxsWERgUAUTcUfzITnyYzup/TDfttH/QxKo5oOY2N08TqXchOODbENwGRi0Ix dv0Iyt0o1i0ltVsFbkqwhMwWuJdqwg9tZt6Bd3G6nAqnXGqwzbtCjLeIsXcBQ1HvKwBm qGbX5ZWPg5ysGJ2eSEHlvR3kgpE2xl9kYHjSlfILXsbDW7zJfECbR48UlIQZz89Z3Noa 4bfGhQLfQzVEtDAGzRB/I2PeXOccDJa2rPIXPjWCWEV/frvHgOVGoORrF6uwWzWsD4bl XmeQ== X-Gm-Message-State: AG10YORN6j2UjY7nrQro7u4JpStcqJa2reRVkFl8UptXEaATCH7wFsGBv0T++IZ8RPb/xQ== X-Received: by 10.66.192.99 with SMTP id hf3mr693005pac.132.1455269838101; Fri, 12 Feb 2016 01:37:18 -0800 (PST) Received: from localhost.localdomain ([106.51.31.162]) by smtp.gmail.com with ESMTPSA id g25sm17972250pfg.35.2016.02.12.01.37.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Feb 2016 01:37:17 -0800 (PST) From: Deepa Dinamani To: linux-fsdevel@vger.kernel.org, y2038@lists.linaro.org Cc: Arnd Bergmann , Dave Chinner , "Theodore Ts'o" , linux-kernel@vger.kernel.org Subject: [RFC v2a 10/12] fs: ceph: Replace timespec data type with vfs_time Date: Fri, 12 Feb 2016 01:36:04 -0800 Message-Id: <1455269766-2994-11-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455269766-2994-1-git-send-email-deepa.kernel@gmail.com> References: <20160212092153.GA2368@deepa-ubuntu> <1455269766-2994-1-git-send-email-deepa.kernel@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The VFS inode timestamps are not y2038 safe as they use struct timespec. These will be changed to use struct timespec64 instead and that is y2038 safe. But, since the above data type conversion will break the end file systems, use vfs_time aliases here to access inode times. Use vfs_time data type for accessing inode timestamps. This is necessary as these accesses need to switch to using 64 bit timestamps along with vfs. Signed-off-by: Deepa Dinamani --- fs/ceph/cache.c | 2 +- fs/ceph/caps.c | 6 +++--- fs/ceph/dir.c | 4 ++-- fs/ceph/file.c | 6 +++--- fs/ceph/inode.c | 32 ++++++++++++++++---------------- fs/ceph/mds_client.c | 2 +- fs/ceph/mds_client.h | 2 +- fs/ceph/super.h | 8 ++++---- fs/ceph/xattr.c | 2 +- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/fs/ceph/cache.c b/fs/ceph/cache.c index a351480..4b5b2da 100644 --- a/fs/ceph/cache.c +++ b/fs/ceph/cache.c @@ -25,7 +25,7 @@ #include "cache.h" struct ceph_aux_inode { - struct timespec mtime; + struct vfs_time mtime; loff_t size; }; diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index cdbf8cf..f407819 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -990,7 +990,7 @@ static int send_cap_msg(struct ceph_mds_session *session, int caps, int wanted, int dirty, u32 seq, u64 flush_tid, u64 oldest_flush_tid, u32 issue_seq, u32 mseq, u64 size, u64 max_size, - struct timespec *mtime, struct timespec *atime, + struct vfs_time *mtime, struct vfs_time *atime, u64 time_warp_seq, kuid_t uid, kgid_t gid, umode_t mode, u64 xattr_version, @@ -1116,7 +1116,7 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, int held, revoking, dropping, keep; u64 seq, issue_seq, mseq, time_warp_seq, follows; u64 size, max_size; - struct timespec mtime, atime; + struct vfs_time mtime, atime; int wake = 0; umode_t mode; kuid_t uid; @@ -2764,7 +2764,7 @@ static void handle_cap_grant(struct ceph_mds_client *mdsc, int used, wanted, dirty; u64 size = le64_to_cpu(grant->size); u64 max_size = le64_to_cpu(grant->max_size); - struct timespec mtime, atime, ctime; + struct vfs_time mtime, atime, ctime; int check_caps = 0; bool wake = false; bool writeback = false; diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index fd11fb2..83e6602 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -1210,7 +1210,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size, " rfiles: %20lld\n" " rsubdirs: %20lld\n" "rbytes: %20lld\n" - "rctime: %10ld.%09ld\n", + "rctime: %10lld.%09ld\n", ci->i_files + ci->i_subdirs, ci->i_files, ci->i_subdirs, @@ -1218,7 +1218,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size, ci->i_rfiles, ci->i_rsubdirs, ci->i_rbytes, - (long)ci->i_rctime.tv_sec, + (long long)ci->i_rctime.tv_sec, (long)ci->i_rctime.tv_nsec); } diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 9b338ff..c8a6f0d 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -555,7 +555,7 @@ struct ceph_aio_request { struct list_head osd_reqs; unsigned num_reqs; atomic_t pending_reqs; - struct timespec mtime; + struct vfs_time mtime; struct ceph_cap_flush *prealloc_cf; }; @@ -783,7 +783,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter, int num_pages = 0; int flags; int ret; - struct timespec mtime = current_fs_time(inode->i_sb); + struct vfs_time 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; @@ -988,7 +988,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_fs_time(inode->i_sb); + struct vfs_time mtime = current_fs_time(inode->i_sb); size_t count = iov_iter_count(from); if (ceph_snap(file_inode(file)) != CEPH_NOSNAP) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 63d0198..b5bce93 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -590,8 +590,8 @@ int ceph_fill_file_size(struct inode *inode, int issued, } void ceph_fill_file_time(struct inode *inode, int issued, - u64 time_warp_seq, struct timespec *ctime, - struct timespec *mtime, struct timespec *atime) + u64 time_warp_seq, struct vfs_time *ctime, + struct vfs_time *mtime, struct vfs_time *atime) { struct ceph_inode_info *ci = ceph_inode(inode); int warn = 0; @@ -601,7 +601,7 @@ void ceph_fill_file_time(struct inode *inode, int issued, CEPH_CAP_FILE_BUFFER| CEPH_CAP_AUTH_EXCL| CEPH_CAP_XATTR_EXCL)) { - if (timespec_compare(ctime, &inode->i_ctime) > 0) { + if (vfs_time_compare(ctime, &inode->i_ctime) > 0) { dout("ctime %ld.%09ld -> %ld.%09ld inc w/ cap\n", inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec, ctime->tv_sec, ctime->tv_nsec); @@ -620,14 +620,14 @@ void ceph_fill_file_time(struct inode *inode, int issued, ci->i_time_warp_seq = time_warp_seq; } else if (time_warp_seq == ci->i_time_warp_seq) { /* nobody did utimes(); take the max */ - if (timespec_compare(mtime, &inode->i_mtime) > 0) { + if (vfs_time_compare(mtime, &inode->i_mtime) > 0) { dout("mtime %ld.%09ld -> %ld.%09ld inc\n", inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec, mtime->tv_sec, mtime->tv_nsec); inode->i_mtime = *mtime; } - if (timespec_compare(atime, &inode->i_atime) > 0) { + if (vfs_time_compare(atime, &inode->i_atime) > 0) { dout("atime %ld.%09ld -> %ld.%09ld inc\n", inode->i_atime.tv_sec, inode->i_atime.tv_nsec, @@ -670,7 +670,7 @@ static int fill_inode(struct inode *inode, struct page *locked_page, struct ceph_mds_reply_inode *info = iinfo->in; struct ceph_inode_info *ci = ceph_inode(inode); int issued = 0, implemented, new_issued; - struct timespec mtime, atime, ctime; + struct vfs_time mtime, atime, ctime; struct ceph_buffer *xattr_blob = NULL; struct ceph_cap *new_cap = NULL; int err = 0; @@ -1871,12 +1871,12 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) inode->i_atime = attr->ia_atime; dirtied |= CEPH_CAP_FILE_EXCL; } else if ((issued & CEPH_CAP_FILE_WR) && - timespec_compare(&inode->i_atime, + vfs_time_compare(&inode->i_atime, &attr->ia_atime) < 0) { inode->i_atime = attr->ia_atime; dirtied |= CEPH_CAP_FILE_WR; } else if ((issued & CEPH_CAP_FILE_SHARED) == 0 || - !timespec_equal(&inode->i_atime, &attr->ia_atime)) { + !vfs_time_equal(&inode->i_atime, &attr->ia_atime)) { ceph_encode_timespec(&req->r_args.setattr.atime, &attr->ia_atime); mask |= CEPH_SETATTR_ATIME; @@ -1885,20 +1885,20 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) } } if (ia_valid & ATTR_MTIME) { - dout("setattr %p mtime %ld.%ld -> %ld.%ld\n", inode, - inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec, - attr->ia_mtime.tv_sec, attr->ia_mtime.tv_nsec); + dout("setattr %p mtime %lld.%ld -> %lld.%ld\n", inode, + (long long) inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec, + (long long) attr->ia_mtime.tv_sec, attr->ia_mtime.tv_nsec); if (issued & CEPH_CAP_FILE_EXCL) { ci->i_time_warp_seq++; inode->i_mtime = attr->ia_mtime; dirtied |= CEPH_CAP_FILE_EXCL; } else if ((issued & CEPH_CAP_FILE_WR) && - timespec_compare(&inode->i_mtime, + vfs_time_compare(&inode->i_mtime, &attr->ia_mtime) < 0) { inode->i_mtime = attr->ia_mtime; dirtied |= CEPH_CAP_FILE_WR; } else if ((issued & CEPH_CAP_FILE_SHARED) == 0 || - !timespec_equal(&inode->i_mtime, &attr->ia_mtime)) { + !vfs_time_equal(&inode->i_mtime, &attr->ia_mtime)) { ceph_encode_timespec(&req->r_args.setattr.mtime, &attr->ia_mtime); mask |= CEPH_SETATTR_MTIME; @@ -1932,9 +1932,9 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) if (ia_valid & ATTR_CTIME) { bool only = (ia_valid & (ATTR_SIZE|ATTR_MTIME|ATTR_ATIME| ATTR_MODE|ATTR_UID|ATTR_GID)) == 0; - dout("setattr %p ctime %ld.%ld -> %ld.%ld (%s)\n", inode, - inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec, - attr->ia_ctime.tv_sec, attr->ia_ctime.tv_nsec, + dout("setattr %p ctime %lld.%ld -> %lld.%ld (%s)\n", inode, + (long long) inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec, + (long long) attr->ia_ctime.tv_sec, attr->ia_ctime.tv_nsec, only ? "ctime only" : "ignored"); inode->i_ctime = attr->ia_ctime; if (only) { diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 348b22e..793be8b 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -1721,7 +1721,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); - ktime_get_real_ts(&req->r_stamp); + vfs_get_real_ts(&req->r_stamp); req->r_op = op; req->r_direct_mode = mode; diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h index ccf11ef..51f8c9d 100644 --- a/fs/ceph/mds_client.h +++ b/fs/ceph/mds_client.h @@ -202,7 +202,7 @@ struct ceph_mds_request { int r_fmode; /* file mode, if expecting cap */ kuid_t r_uid; kgid_t r_gid; - struct timespec r_stamp; + struct vfs_time r_stamp; /* for choosing which mds to send this request to */ int r_direct_mode; diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 75b7d12..2acbc96 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -169,7 +169,7 @@ struct ceph_cap_snap { u64 xattr_version; u64 size; - struct timespec mtime, atime, ctime; + struct vfs_time mtime, atime, ctime; u64 time_warp_seq; int writing; /* a sync write is still in progress */ int dirty_pages; /* dirty pages awaiting writeback */ @@ -290,7 +290,7 @@ struct ceph_inode_info { char *i_symlink; /* for dirs */ - struct timespec i_rctime; + struct vfs_time i_rctime; u64 i_rbytes, i_rfiles, i_rsubdirs; u64 i_files, i_subdirs; @@ -764,8 +764,8 @@ extern struct inode *ceph_get_snapdir(struct inode *parent); extern int ceph_fill_file_size(struct inode *inode, int issued, u32 truncate_seq, u64 truncate_size, u64 size); extern void ceph_fill_file_time(struct inode *inode, int issued, - u64 time_warp_seq, struct timespec *ctime, - struct timespec *mtime, struct timespec *atime); + u64 time_warp_seq, struct vfs_time *ctime, + struct vfs_time *mtime, struct vfs_time *atime); extern int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, struct ceph_mds_session *session); diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index 1e1c00a..db5328d 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c @@ -198,7 +198,7 @@ static size_t ceph_vxattrcb_dir_rbytes(struct ceph_inode_info *ci, char *val, static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val, size_t size) { - return snprintf(val, size, "%ld.09%ld", (long)ci->i_rctime.tv_sec, + return snprintf(val, size, "%lld.09%ld", (long long)ci->i_rctime.tv_sec, (long)ci->i_rctime.tv_nsec); }