Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ceph: Switch to use %ptSp

Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.

Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20251113150217.3030010-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Petr Mladek <pmladek@suse.com>

authored by

Andy Shevchenko and committed by
Petr Mladek
46ac6f51 bccd5937

+20 -40
+2 -3
fs/ceph/dir.c
··· 2156 2156 " rfiles: %20lld\n" 2157 2157 " rsubdirs: %20lld\n" 2158 2158 "rbytes: %20lld\n" 2159 - "rctime: %10lld.%09ld\n", 2159 + "rctime: %ptSp\n", 2160 2160 ci->i_files + ci->i_subdirs, 2161 2161 ci->i_files, 2162 2162 ci->i_subdirs, ··· 2164 2164 ci->i_rfiles, 2165 2165 ci->i_rsubdirs, 2166 2166 ci->i_rbytes, 2167 - ci->i_rctime.tv_sec, 2168 - ci->i_rctime.tv_nsec); 2167 + &ci->i_rctime); 2169 2168 } 2170 2169 2171 2170 if (*ppos >= dfi->dir_info_len)
+16 -33
fs/ceph/inode.c
··· 879 879 { 880 880 struct ceph_client *cl = ceph_inode_to_client(inode); 881 881 struct ceph_inode_info *ci = ceph_inode(inode); 882 + struct timespec64 iatime = inode_get_atime(inode); 882 883 struct timespec64 ictime = inode_get_ctime(inode); 884 + struct timespec64 imtime = inode_get_mtime(inode); 883 885 int warn = 0; 884 886 885 887 if (issued & (CEPH_CAP_FILE_EXCL| ··· 891 889 CEPH_CAP_XATTR_EXCL)) { 892 890 if (ci->i_version == 0 || 893 891 timespec64_compare(ctime, &ictime) > 0) { 894 - doutc(cl, "ctime %lld.%09ld -> %lld.%09ld inc w/ cap\n", 895 - ictime.tv_sec, ictime.tv_nsec, 896 - ctime->tv_sec, ctime->tv_nsec); 892 + doutc(cl, "ctime %ptSp -> %ptSp inc w/ cap\n", &ictime, ctime); 897 893 inode_set_ctime_to_ts(inode, *ctime); 898 894 } 899 895 if (ci->i_version == 0 || 900 896 ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) > 0) { 901 897 /* the MDS did a utimes() */ 902 - doutc(cl, "mtime %lld.%09ld -> %lld.%09ld tw %d -> %d\n", 903 - inode_get_mtime_sec(inode), 904 - inode_get_mtime_nsec(inode), 905 - mtime->tv_sec, mtime->tv_nsec, 906 - ci->i_time_warp_seq, (int)time_warp_seq); 898 + doutc(cl, "mtime %ptSp -> %ptSp tw %d -> %d\n", &imtime, mtime, 899 + ci->i_time_warp_seq, (int)time_warp_seq); 907 900 908 901 inode_set_mtime_to_ts(inode, *mtime); 909 902 inode_set_atime_to_ts(inode, *atime); 910 903 ci->i_time_warp_seq = time_warp_seq; 911 904 } else if (time_warp_seq == ci->i_time_warp_seq) { 912 - struct timespec64 ts; 913 - 914 905 /* nobody did utimes(); take the max */ 915 - ts = inode_get_mtime(inode); 916 - if (timespec64_compare(mtime, &ts) > 0) { 917 - doutc(cl, "mtime %lld.%09ld -> %lld.%09ld inc\n", 918 - ts.tv_sec, ts.tv_nsec, 919 - mtime->tv_sec, mtime->tv_nsec); 906 + if (timespec64_compare(mtime, &imtime) > 0) { 907 + doutc(cl, "mtime %ptSp -> %ptSp inc\n", &imtime, mtime); 920 908 inode_set_mtime_to_ts(inode, *mtime); 921 909 } 922 - ts = inode_get_atime(inode); 923 - if (timespec64_compare(atime, &ts) > 0) { 924 - doutc(cl, "atime %lld.%09ld -> %lld.%09ld inc\n", 925 - ts.tv_sec, ts.tv_nsec, 926 - atime->tv_sec, atime->tv_nsec); 910 + if (timespec64_compare(atime, &iatime) > 0) { 911 + doutc(cl, "atime %ptSp -> %ptSp inc\n", &iatime, atime); 927 912 inode_set_atime_to_ts(inode, *atime); 928 913 } 929 914 } else if (issued & CEPH_CAP_FILE_EXCL) { ··· 2681 2692 if (ia_valid & ATTR_ATIME) { 2682 2693 struct timespec64 atime = inode_get_atime(inode); 2683 2694 2684 - doutc(cl, "%p %llx.%llx atime %lld.%09ld -> %lld.%09ld\n", 2685 - inode, ceph_vinop(inode), 2686 - atime.tv_sec, atime.tv_nsec, 2687 - attr->ia_atime.tv_sec, attr->ia_atime.tv_nsec); 2695 + doutc(cl, "%p %llx.%llx atime %ptSp -> %ptSp\n", 2696 + inode, ceph_vinop(inode), &atime, &attr->ia_atime); 2688 2697 if (!do_sync && (issued & CEPH_CAP_FILE_EXCL)) { 2689 2698 ci->i_time_warp_seq++; 2690 2699 inode_set_atime_to_ts(inode, attr->ia_atime); ··· 2756 2769 if (ia_valid & ATTR_MTIME) { 2757 2770 struct timespec64 mtime = inode_get_mtime(inode); 2758 2771 2759 - doutc(cl, "%p %llx.%llx mtime %lld.%09ld -> %lld.%09ld\n", 2760 - inode, ceph_vinop(inode), 2761 - mtime.tv_sec, mtime.tv_nsec, 2762 - attr->ia_mtime.tv_sec, attr->ia_mtime.tv_nsec); 2772 + doutc(cl, "%p %llx.%llx mtime %ptSp -> %ptSp\n", 2773 + inode, ceph_vinop(inode), &mtime, &attr->ia_mtime); 2763 2774 if (!do_sync && (issued & CEPH_CAP_FILE_EXCL)) { 2764 2775 ci->i_time_warp_seq++; 2765 2776 inode_set_mtime_to_ts(inode, attr->ia_mtime); ··· 2778 2793 2779 2794 /* these do nothing */ 2780 2795 if (ia_valid & ATTR_CTIME) { 2796 + struct timespec64 ictime = inode_get_ctime(inode); 2781 2797 bool only = (ia_valid & (ATTR_SIZE|ATTR_MTIME|ATTR_ATIME| 2782 2798 ATTR_MODE|ATTR_UID|ATTR_GID)) == 0; 2783 - doutc(cl, "%p %llx.%llx ctime %lld.%09ld -> %lld.%09ld (%s)\n", 2784 - inode, ceph_vinop(inode), 2785 - inode_get_ctime_sec(inode), 2786 - inode_get_ctime_nsec(inode), 2787 - attr->ia_ctime.tv_sec, attr->ia_ctime.tv_nsec, 2799 + doutc(cl, "%p %llx.%llx ctime %ptSp -> %ptSp (%s)\n", 2800 + inode, ceph_vinop(inode), &ictime, &attr->ia_ctime, 2788 2801 only ? "ctime only" : "ignored"); 2789 2802 if (only) { 2790 2803 /*
+2 -4
fs/ceph/xattr.c
··· 249 249 static ssize_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val, 250 250 size_t size) 251 251 { 252 - return ceph_fmt_xattr(val, size, "%lld.%09ld", ci->i_rctime.tv_sec, 253 - ci->i_rctime.tv_nsec); 252 + return ceph_fmt_xattr(val, size, "%ptSp", &ci->i_rctime); 254 253 } 255 254 256 255 /* dir pin */ ··· 306 307 static ssize_t ceph_vxattrcb_snap_btime(struct ceph_inode_info *ci, char *val, 307 308 size_t size) 308 309 { 309 - return ceph_fmt_xattr(val, size, "%lld.%09ld", ci->i_snap_btime.tv_sec, 310 - ci->i_snap_btime.tv_nsec); 310 + return ceph_fmt_xattr(val, size, "%ptSp", &ci->i_snap_btime); 311 311 } 312 312 313 313 static ssize_t ceph_vxattrcb_cluster_fsid(struct ceph_inode_info *ci,