[f2fs-dev] [PATCH 04/21] fs: Replace CURRENT_TIME with current_fs_time() for inode timestamps
CURRENT_TIME macro is not appropriate for filesystems as it doesn't use the right granularity for filesystem timestamps. Use current_fs_time() instead. CURRENT_TIME is also not y2038 safe. This is also in preparation for the patch that transitions vfs timestamps to use 64 bit time and hence make them y2038 safe. As part of the effort current_fs_time() will be extended to do range checks. Hence, it is necessary for all file system timestamps to use current_fs_time(). Also, current_fs_time() will be transitioned along with vfs to be y2038 safe. Signed-off-by: Deepa DinamaniCc: Steve French Cc: linux-c...@vger.kernel.org Cc: samba-techni...@lists.samba.org Cc: Joern Engel Cc: Prasad Joshi Cc: lo...@logfs.org Cc: Andrew Morton Cc: Julia Lawall Cc: David Howells Cc: Firo Yang Cc: Jaegeuk Kim Cc: Changman Lee Cc: Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net Cc: Michal Hocko Cc: Konstantin Khlebnikov Cc: Naoya Horiguchi Cc: "J. Bruce Fields" Cc: Jeff Layton Cc: Trond Myklebust Cc: Anna Schumaker Cc: "David S. Miller" Cc: linux-...@vger.kernel.org Cc: net...@vger.kernel.org Cc: Steven Whitehouse Cc: Bob Peterson Cc: cluster-de...@redhat.com Cc: Mark Fasheh Cc: Joel Becker Cc: ocfs2-de...@oss.oracle.com Cc: Anton Vorontsov Cc: Colin Cross Cc: Kees Cook Cc: Tony Luck Cc: Chris Mason Cc: Josef Bacik Cc: David Sterba Cc: linux-bt...@vger.kernel.org Cc: Miklos Szeredi Cc: fuse-de...@lists.sourceforge.net Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: linux-...@vger.kernel.org Cc: Doug Ledford Cc: Sean Hefty Cc: Hal Rosenstock Cc: linux-r...@vger.kernel.org Cc: Robert Richter Cc: oprofile-l...@lists.sf.net Cc: Alexei Starovoitov Cc: Hugh Dickins Cc: linux...@kvack.org Cc: Paul Moore Cc: Stephen Smalley Cc: Eric Paris Cc: seli...@tycho.nsa.gov Cc: James Morris Cc: "Serge E. Hallyn" Cc: linux-security-mod...@vger.kernel.org Cc: Eric Van Hensbergen Cc: Ron Minnich Cc: Latchesar Ionkov Cc: v9fs-develo...@lists.sourceforge.net Cc: Ian Kent Cc: aut...@vger.kernel.org Cc: Matthew Garrett Cc: Jeremy Kerr Cc: Matt Fleming Cc: linux-...@vger.kernel.org Cc: Peter Hurley Cc: Josh Triplett Cc: Boaz Harrosh Cc: Benny Halevy Cc: osd-...@open-osd.org Cc: Mike Marshall Cc: pvfs2-develop...@beowulf-underground.org Cc: Nadia Yvette Chambers Cc: Dave Kleikamp Cc: jfs-discuss...@lists.sourceforge.net Cc: Ryusuke Konishi Cc: linux-ni...@vger.kernel.org --- arch/powerpc/platforms/cell/spufs/inode.c | 2 +- arch/s390/hypfs/inode.c | 4 ++-- drivers/infiniband/hw/qib/qib_fs.c| 2 +- drivers/misc/ibmasm/ibmasmfs.c| 2 +- drivers/oprofile/oprofilefs.c | 2 +- drivers/usb/core/devio.c | 19 + drivers/usb/gadget/function/f_fs.c| 2 +- drivers/usb/gadget/legacy/inode.c | 2 +- fs/9p/vfs_inode.c | 2 +- fs/adfs/inode.c | 2 +- fs/autofs4/inode.c| 2 +- fs/autofs4/root.c | 19 ++--- fs/btrfs/inode.c | 2 +- fs/devpts/inode.c | 6 +++--- fs/efivarfs/inode.c | 2 +- fs/exofs/dir.c| 9 fs/exofs/inode.c | 7 --- fs/exofs/namei.c | 6 +++--- fs/f2fs/dir.c | 8 +++ fs/f2fs/file.c| 8 +++ fs/f2fs/inline.c | 2 +- fs/f2fs/namei.c | 12 +-- fs/f2fs/xattr.c | 2 +- fs/fuse/control.c | 2 +-
[f2fs-dev] [PATCH 10/21] fs: f2fs: Use ktime_get_real_seconds for sit_info times
CURRENT_TIME_SEC is not y2038 safe. Replace use of CURRENT_TIME_SEC with ktime_get_real_seconds in segment timestamps used by GC algorithm including the segment mtime timestamps. Signed-off-by: Deepa DinamaniCc: Jaegeuk Kim Cc: Changman Lee Cc: Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net --- fs/f2fs/segment.c | 2 +- fs/f2fs/segment.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 2e6f537..bde5dbd 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -2123,7 +2123,7 @@ static int build_sit_info(struct f2fs_sb_info *sbi) sit_i->dirty_sentries = 0; sit_i->sents_per_block = SIT_ENTRY_PER_BLOCK; sit_i->elapsed_time = le64_to_cpu(sbi->ckpt->elapsed_time); - sit_i->mounted_time = CURRENT_TIME_SEC.tv_sec; + sit_i->mounted_time = ktime_get_real_seconds(); mutex_init(_i->sentry_lock); return 0; } diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 7a756ff..da3e87f 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -652,8 +652,9 @@ static inline void set_to_next_sit(struct sit_info *sit_i, unsigned int start) static inline unsigned long long get_mtime(struct f2fs_sb_info *sbi) { struct sit_info *sit_i = SIT_I(sbi); - return sit_i->elapsed_time + CURRENT_TIME_SEC.tv_sec - - sit_i->mounted_time; + time64_t now = ktime_get_real_seconds(); + + return sit_i->elapsed_time + now - sit_i->mounted_time; } static inline void set_summary(struct f2fs_summary *sum, nid_t nid, -- 1.9.1 -- What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
[f2fs-dev] [PATCH 00/21] Delete CURRENT_TIME and CURRENT_TIME_SEC macros
The series is aimed at getting rid of CURRENT_TIME and CURRENT_TIME_SEC macros. The macros are not y2038 safe. There is no plan to transition them into being y2038 safe. ktime_get_* api's can be used in their place. And, these are y2038 safe. All filesystem timestamps use current_fs_time() for the right granularity as mentioned in the respective commit texts of patches. This series also serves as a preparatory series to transition vfs to 64 bit timestamps as outlined here: https://lkml.org/lkml/2016/2/12/104 . As per Linus's suggestion in https://lkml.org/lkml/2016/5/24/663 , all the inode timestamp changes have been squashed into a single patch. Also, current_fs_time() now is used as a single generic filesystem timestamp api. Posting all patches together in a bigger series so that the big picture is clear. As per the suggestion in https://lwn.net/Articles/672598/ , CURRENT_TIME macro bug fixes are being handled in a series separate from transitioning vfs to use 64 bit timestamps. Some reviewers have requested not to change line wrapping only for the longer function call names, so checkpatch warnings for such cases are ignored in the patch series. Deepa Dinamani (21): fs: Replace CURRENT_TIME_SEC with current_fs_time() fs: ext4: Use current_fs_time() for inode timestamps fs: ubifs: Use current_fs_time() for inode timestamps fs: Replace CURRENT_TIME with current_fs_time() for inode timestamps fs: jfs: Replace CURRENT_TIME_SEC by current_fs_time() fs: udf: Replace CURRENT_TIME with current_fs_time() fs: cifs: Replace CURRENT_TIME by current_fs_time() fs: cifs: Replace CURRENT_TIME with ktime_get_real_ts() fs: cifs: Replace CURRENT_TIME by get_seconds fs: f2fs: Use ktime_get_real_seconds for sit_info times drivers: staging: lustre: Replace CURRENT_TIME with current_fs_time() block: rbd: Replace non inode CURRENT_TIME with current_fs_time() fs: ocfs2: Use time64_t to represent orphan scan times fs: ocfs2: Replace CURRENT_TIME with ktime_get_real_seconds() time: Add time64_to_tm() fnic: Use time64_t to represent trace timestamps audit: Use timespec64 to represent audit timestamps fs: nfs: Make nfs boot time y2038 safe libceph: Remove CURRENT_TIME references libceph: Replace CURRENT_TIME with ktime_get_real_ts time: Delete CURRENT_TIME_SEC and CURRENT_TIME macro arch/powerpc/platforms/cell/spufs/inode.c | 2 +- arch/s390/hypfs/inode.c| 4 +-- drivers/block/rbd.c| 2 +- drivers/infiniband/hw/qib/qib_fs.c | 2 +- drivers/misc/ibmasm/ibmasmfs.c | 2 +- drivers/oprofile/oprofilefs.c | 2 +- drivers/scsi/fnic/fnic_trace.c | 4 +-- drivers/scsi/fnic/fnic_trace.h | 2 +- drivers/staging/lustre/lustre/llite/llite_lib.c| 17 ++- drivers/staging/lustre/lustre/llite/namei.c| 4 +-- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 6 ++-- .../lustre/lustre/obdclass/linux/linux-obdo.c | 6 ++-- drivers/staging/lustre/lustre/obdclass/obdo.c | 6 ++-- drivers/staging/lustre/lustre/osc/osc_io.c | 2 +- drivers/usb/core/devio.c | 19 ++-- drivers/usb/gadget/function/f_fs.c | 2 +- drivers/usb/gadget/legacy/inode.c | 2 +- fs/9p/vfs_inode.c | 2 +- fs/adfs/inode.c| 2 +- fs/affs/amigaffs.c | 6 ++-- fs/affs/inode.c| 2 +- fs/afs/inode.c | 3 +- fs/autofs4/inode.c | 2 +- fs/autofs4/root.c | 19 +++- fs/bfs/dir.c | 18 ++- fs/btrfs/inode.c | 2 +- fs/cifs/cifsencrypt.c | 4 ++- fs/cifs/cifssmb.c | 10 +++ fs/cifs/inode.c| 15 +- fs/coda/dir.c | 2 +- fs/coda/file.c | 2 +- fs/coda/inode.c| 2 +- fs/devpts/inode.c | 6 ++-- fs/efivarfs/inode.c| 2 +- fs/exofs/dir.c | 9 +++--- fs/exofs/inode.c | 7 +++-- fs/exofs/namei.c | 6 ++-- fs/ext2/acl.c | 2 +- fs/ext2/dir.c | 6 ++-- fs/ext2/ialloc.c | 2 +- fs/ext2/inode.c| 4 +-- fs/ext2/ioctl.c| 5 ++-- fs/ext2/namei.c|
Re: [f2fs-dev] [PATCH 04/21] fs: Replace CURRENT_TIME with current_fs_time() for inode timestamps
On Wed, Jun 08, 2016 at 10:04:48PM -0700, Deepa Dinamani wrote: > CURRENT_TIME macro is not appropriate for filesystems as it > doesn't use the right granularity for filesystem timestamps. > Use current_fs_time() instead. > > CURRENT_TIME is also not y2038 safe. > > This is also in preparation for the patch that transitions > vfs timestamps to use 64 bit time and hence make them > y2038 safe. As part of the effort current_fs_time() will be > extended to do range checks. Hence, it is necessary for all > file system timestamps to use current_fs_time(). Also, > current_fs_time() will be transitioned along with vfs to be > y2038 safe. > > Signed-off-by: Deepa Dinamani> Cc: David Sterba for the btrfs bits Reviewed-by: David Sterba -- What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Re: [f2fs-dev] [PATCH 04/21] fs: Replace CURRENT_TIME with current_fs_time() for inode timestamps
for nilfs2 bits: Acked-by: Ryusuke KonishiThanks, Ryusuke Konishi -- What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Re: [f2fs-dev] [PATCH 04/21] fs: Replace CURRENT_TIME with current_fs_time() for inode timestamps
On Wed, Jun 8, 2016 at 10:04 PM, Deepa Dinamaniwrote: > CURRENT_TIME macro is not appropriate for filesystems as it > doesn't use the right granularity for filesystem timestamps. > Use current_fs_time() instead. Again - using the inode instead fo the syuperblock in tghis patch would have made the patch much more obvious (it could have been 99% generated with the sed-script I sent out a week or two ago), and it would have made it unnecessary to add these kinds of things: > diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c > index e9f5043..85c12f0 100644 > --- a/drivers/usb/core/devio.c > +++ b/drivers/usb/core/devio.c > @@ -2359,6 +2359,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned > int cmd, > { > struct usb_dev_state *ps = file->private_data; > struct inode *inode = file_inode(file); > + struct super_block *sb = inode->i_sb; > struct usb_device *dev = ps->dev; > int ret = -ENOTTY; where we add a new variable just because the calling convention was wrong. It's not even 100% obvious that a filesystem has to have one single time representation, so making the time function about the entity whose time is set is also conceptually a much better model, never mind that it is just what every single user seems to want anyway. So I'd *much* rather see + inode->i_atime = inode->i_mtime = inode->i_ctime = current_fs_time(inode); over seeing either of these two variants:: + inode->i_atime = inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb); + ret->i_atime = ret->i_mtime = ret->i_ctime = current_fs_time(sb); because the first of those variants (grep for current_fs_time() in the current git tree, and notice that it's the common one) we have the pointless "let's chase a pointer in every caller" And while it's true that the second variant is natural for *some* situations, I've yet to find one where it wasn't equally sane to just pass in the inode instead. Linus -- What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel