From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Corey Minyard" <corey@minyard.net>,
"Christian König" <christian.koenig@amd.com>,
"Dr. David Alan Gilbert" <linux@treblig.org>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>,
"Rob Clark" <robin.clark@oss.qualcomm.com>,
"Matthew Brost" <matthew.brost@intel.com>,
"Ulf Hansson" <ulf.hansson@linaro.org>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Aleksandr Loktionov" <aleksandr.loktionov@intel.com>,
"Vitaly Lifshits" <vitaly.lifshits@intel.com>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Niklas Cassel" <cassel@kernel.org>,
"Calvin Owens" <calvin@wbinvd.org>,
"Vadim Fedorenko" <vadim.fedorenko@linux.dev>,
"Sagi Maimon" <maimon.sagi@gmail.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"Karan Tilak Kumar" <kartilak@cisco.com>,
"Hans Verkuil" <hverkuil+cisco@kernel.org>,
"Casey Schaufler" <casey@schaufler-ca.com>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Petr Mladek" <pmladek@suse.com>,
"Viacheslav Dubeyko" <Slava.Dubeyko@ibm.com>,
"Max Kellermann" <max.kellermann@ionos.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
openipmi-developer@lists.sourceforge.net,
linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
linaro-mm-sig@lists.linaro.org, amd-gfx@lists.freedesktop.org,
linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org,
intel-xe@lists.freedesktop.org, linux-mmc@vger.kernel.org,
netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
linux-pci@vger.kernel.org, linux-s390@vger.kernel.org,
linux-scsi@vger.kernel.org, linux-staging@lists.linux.dev,
ceph-devel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Cc: "Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
"Sergey Senozhatsky" <senozhatsky@chromium.org>,
"Jonathan Corbet" <corbet@lwn.net>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Gustavo Padovan" <gustavo@padovan.org>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Dmitry Baryshkov" <lumag@kernel.org>,
"Abhinav Kumar" <abhinav.kumar@linux.dev>,
"Jessica Zhang" <jesszhan0024@gmail.com>,
"Sean Paul" <sean@poorly.run>,
"Marijn Suijten" <marijn.suijten@somainline.org>,
"Konrad Dybcio" <konradybcio@kernel.org>,
"Lucas De Marchi" <lucas.demarchi@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Vladimir Oltean" <olteanv@gmail.com>,
"Andrew Lunn" <andrew@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Tony Nguyen" <anthony.l.nguyen@intel.com>,
"Przemek Kitszel" <przemyslaw.kitszel@intel.com>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Rodolfo Giometti" <giometti@enneenne.com>,
"Jonathan Lemon" <jonathan.lemon@gmail.com>,
"Richard Cochran" <richardcochran@gmail.com>,
"Stefan Haberland" <sth@linux.ibm.com>,
"Jan Hoeppner" <hoeppner@linux.ibm.com>,
"Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Sven Schnelle" <svens@linux.ibm.com>,
"Satish Kharat" <satishkh@cisco.com>,
"Sesidhar Baddela" <sebaddel@cisco.com>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Xiubo Li" <xiubli@redhat.com>,
"Ilya Dryomov" <idryomov@gmail.com>,
"Masami Hiramatsu" <mhiramat@kernel.org>,
"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
"Andrew Morton" <akpm@linux-foundation.org>
Subject: [PATCH v3 02/21] ceph: Switch to use %ptSp
Date: Thu, 13 Nov 2025 15:32:16 +0100 [thread overview]
Message-ID: <20251113150217.3030010-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
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>
---
fs/ceph/dir.c | 5 ++---
fs/ceph/inode.c | 49 ++++++++++++++++---------------------------------
fs/ceph/xattr.c | 6 ++----
3 files changed, 20 insertions(+), 40 deletions(-)
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index d18c0eaef9b7..bf50c6e7a029 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -2155,7 +2155,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: %10lld.%09ld\n",
+ "rctime: %ptSp\n",
ci->i_files + ci->i_subdirs,
ci->i_files,
ci->i_subdirs,
@@ -2163,8 +2163,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,
- ci->i_rctime.tv_sec,
- ci->i_rctime.tv_nsec);
+ &ci->i_rctime);
}
if (*ppos >= dfi->dir_info_len)
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 37d3a2477c17..a596cb53f1ac 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -879,7 +879,9 @@ void ceph_fill_file_time(struct inode *inode, int issued,
{
struct ceph_client *cl = ceph_inode_to_client(inode);
struct ceph_inode_info *ci = ceph_inode(inode);
+ struct timespec64 iatime = inode_get_atime(inode);
struct timespec64 ictime = inode_get_ctime(inode);
+ struct timespec64 imtime = inode_get_mtime(inode);
int warn = 0;
if (issued & (CEPH_CAP_FILE_EXCL|
@@ -889,39 +891,26 @@ void ceph_fill_file_time(struct inode *inode, int issued,
CEPH_CAP_XATTR_EXCL)) {
if (ci->i_version == 0 ||
timespec64_compare(ctime, &ictime) > 0) {
- doutc(cl, "ctime %lld.%09ld -> %lld.%09ld inc w/ cap\n",
- ictime.tv_sec, ictime.tv_nsec,
- ctime->tv_sec, ctime->tv_nsec);
+ doutc(cl, "ctime %ptSp -> %ptSp inc w/ cap\n", &ictime, ctime);
inode_set_ctime_to_ts(inode, *ctime);
}
if (ci->i_version == 0 ||
ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) > 0) {
/* the MDS did a utimes() */
- doutc(cl, "mtime %lld.%09ld -> %lld.%09ld tw %d -> %d\n",
- inode_get_mtime_sec(inode),
- inode_get_mtime_nsec(inode),
- mtime->tv_sec, mtime->tv_nsec,
- ci->i_time_warp_seq, (int)time_warp_seq);
+ doutc(cl, "mtime %ptSp -> %ptSp tw %d -> %d\n", &imtime, mtime,
+ ci->i_time_warp_seq, (int)time_warp_seq);
inode_set_mtime_to_ts(inode, *mtime);
inode_set_atime_to_ts(inode, *atime);
ci->i_time_warp_seq = time_warp_seq;
} else if (time_warp_seq == ci->i_time_warp_seq) {
- struct timespec64 ts;
-
/* nobody did utimes(); take the max */
- ts = inode_get_mtime(inode);
- if (timespec64_compare(mtime, &ts) > 0) {
- doutc(cl, "mtime %lld.%09ld -> %lld.%09ld inc\n",
- ts.tv_sec, ts.tv_nsec,
- mtime->tv_sec, mtime->tv_nsec);
+ if (timespec64_compare(mtime, &imtime) > 0) {
+ doutc(cl, "mtime %ptSp -> %ptSp inc\n", &imtime, mtime);
inode_set_mtime_to_ts(inode, *mtime);
}
- ts = inode_get_atime(inode);
- if (timespec64_compare(atime, &ts) > 0) {
- doutc(cl, "atime %lld.%09ld -> %lld.%09ld inc\n",
- ts.tv_sec, ts.tv_nsec,
- atime->tv_sec, atime->tv_nsec);
+ if (timespec64_compare(atime, &iatime) > 0) {
+ doutc(cl, "atime %ptSp -> %ptSp inc\n", &iatime, atime);
inode_set_atime_to_ts(inode, *atime);
}
} else if (issued & CEPH_CAP_FILE_EXCL) {
@@ -2703,10 +2692,8 @@ int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode,
if (ia_valid & ATTR_ATIME) {
struct timespec64 atime = inode_get_atime(inode);
- doutc(cl, "%p %llx.%llx atime %lld.%09ld -> %lld.%09ld\n",
- inode, ceph_vinop(inode),
- atime.tv_sec, atime.tv_nsec,
- attr->ia_atime.tv_sec, attr->ia_atime.tv_nsec);
+ doutc(cl, "%p %llx.%llx atime %ptSp -> %ptSp\n",
+ inode, ceph_vinop(inode), &atime, &attr->ia_atime);
if (!do_sync && (issued & CEPH_CAP_FILE_EXCL)) {
ci->i_time_warp_seq++;
inode_set_atime_to_ts(inode, attr->ia_atime);
@@ -2780,10 +2767,8 @@ int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode,
if (ia_valid & ATTR_MTIME) {
struct timespec64 mtime = inode_get_mtime(inode);
- doutc(cl, "%p %llx.%llx mtime %lld.%09ld -> %lld.%09ld\n",
- inode, ceph_vinop(inode),
- mtime.tv_sec, mtime.tv_nsec,
- attr->ia_mtime.tv_sec, attr->ia_mtime.tv_nsec);
+ doutc(cl, "%p %llx.%llx mtime %ptSp -> %ptSp\n",
+ inode, ceph_vinop(inode), &mtime, &attr->ia_mtime);
if (!do_sync && (issued & CEPH_CAP_FILE_EXCL)) {
ci->i_time_warp_seq++;
inode_set_mtime_to_ts(inode, attr->ia_mtime);
@@ -2804,13 +2789,11 @@ int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode,
/* these do nothing */
if (ia_valid & ATTR_CTIME) {
+ struct timespec64 ictime = inode_get_ctime(inode);
bool only = (ia_valid & (ATTR_SIZE|ATTR_MTIME|ATTR_ATIME|
ATTR_MODE|ATTR_UID|ATTR_GID)) == 0;
- doutc(cl, "%p %llx.%llx ctime %lld.%09ld -> %lld.%09ld (%s)\n",
- inode, ceph_vinop(inode),
- inode_get_ctime_sec(inode),
- inode_get_ctime_nsec(inode),
- attr->ia_ctime.tv_sec, attr->ia_ctime.tv_nsec,
+ doutc(cl, "%p %llx.%llx ctime %ptSp -> %ptSp (%s)\n",
+ inode, ceph_vinop(inode), &ictime, &attr->ia_ctime,
only ? "ctime only" : "ignored");
if (only) {
/*
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index 537165db4519..ad1f30bea175 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -249,8 +249,7 @@ static ssize_t ceph_vxattrcb_dir_rbytes(struct ceph_inode_info *ci, char *val,
static ssize_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val,
size_t size)
{
- return ceph_fmt_xattr(val, size, "%lld.%09ld", ci->i_rctime.tv_sec,
- ci->i_rctime.tv_nsec);
+ return ceph_fmt_xattr(val, size, "%ptSp", &ci->i_rctime);
}
/* dir pin */
@@ -307,8 +306,7 @@ static bool ceph_vxattrcb_snap_btime_exists(struct ceph_inode_info *ci)
static ssize_t ceph_vxattrcb_snap_btime(struct ceph_inode_info *ci, char *val,
size_t size)
{
- return ceph_fmt_xattr(val, size, "%lld.%09ld", ci->i_snap_btime.tv_sec,
- ci->i_snap_btime.tv_nsec);
+ return ceph_fmt_xattr(val, size, "%ptSp", &ci->i_snap_btime);
}
static ssize_t ceph_vxattrcb_cluster_fsid(struct ceph_inode_info *ci,
--
2.50.1
next prev parent reply other threads:[~2025-11-13 15:02 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-13 14:32 [PATCH v3 00/21] treewide: Introduce %ptS for struct timespec64 and convert users Andy Shevchenko
2025-11-13 14:32 ` [PATCH v3 01/21] lib/vsprintf: Add specifier for printing struct timespec64 Andy Shevchenko
2025-11-14 12:59 ` Petr Mladek
[not found] ` <aRd5HHUBu2ookDv_@smile.fi.intel.com>
2025-11-19 9:14 ` Andy Shevchenko
2025-11-13 14:32 ` Andy Shevchenko [this message]
2025-11-13 14:32 ` [PATCH v3 03/21] libceph: Switch to use %ptSp Andy Shevchenko
2025-11-13 14:32 ` [PATCH v3 04/21] dma-buf: " Andy Shevchenko
2025-11-13 14:32 ` [PATCH v3 05/21] drm/amdgpu: " Andy Shevchenko
2025-11-13 14:32 ` [PATCH v3 06/21] drm/msm: " Andy Shevchenko
2025-11-14 4:12 ` Dmitry Baryshkov
2025-11-13 14:32 ` [PATCH v3 07/21] drm/vblank: " Andy Shevchenko
2025-11-13 14:32 ` [PATCH v3 08/21] drm/xe: " Andy Shevchenko
2025-11-13 14:32 ` [PATCH v3 09/21] e1000e: " Andy Shevchenko
2025-11-13 14:32 ` [PATCH v3 10/21] igb: " Andy Shevchenko
2025-11-13 14:32 ` [PATCH v3 11/21] ipmi: " Andy Shevchenko
2025-11-13 14:32 ` [PATCH v3 12/21] media: av7110: " Andy Shevchenko
2025-11-13 14:32 ` [PATCH v3 13/21] mmc: mmc_test: " Andy Shevchenko
2025-11-17 11:00 ` Ulf Hansson
2025-11-13 14:32 ` [PATCH v3 14/21] net: dsa: sja1105: " Andy Shevchenko
2025-11-18 18:50 ` Vladimir Oltean
2025-11-13 14:32 ` [PATCH v3 15/21] PCI: epf-test: " Andy Shevchenko
2025-11-19 15:49 ` Manivannan Sadhasivam
2025-11-13 14:32 ` [PATCH v3 16/21] pps: " Andy Shevchenko
2025-11-13 14:32 ` [PATCH v3 17/21] ptp: ocp: " Andy Shevchenko
2025-11-13 14:32 ` [PATCH v3 18/21] s390/dasd: " Andy Shevchenko
2025-11-18 15:23 ` Stefan Haberland
2025-11-13 14:32 ` [PATCH v3 19/21] scsi: fnic: " Andy Shevchenko
2025-11-13 22:34 ` Karan Tilak Kumar (kartilak)
[not found] ` <aRbreoKzashQcEne@smile.fi.intel.com>
2025-11-18 18:53 ` Karan Tilak Kumar (kartilak)
2025-11-19 10:08 ` Petr Mladek
2025-11-19 10:26 ` Andy Shevchenko
2025-11-13 14:32 ` [PATCH v3 20/21] scsi: snic: " Andy Shevchenko
2025-11-15 20:27 ` Karan Tilak Kumar (kartilak)
2025-11-13 14:32 ` [PATCH v3 21/21] tracing: " Andy Shevchenko
2025-11-19 13:11 ` [PATCH v3 00/21] treewide: Introduce %ptS for struct timespec64 and convert users Petr Mladek
2025-11-19 14:59 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251113150217.3030010-3-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=Slava.Dubeyko@ibm.com \
--cc=abhinav.kumar@linux.dev \
--cc=agordeev@linux.ibm.com \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=aleksandr.loktionov@intel.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=andrew@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=bhelgaas@google.com \
--cc=borntraeger@linux.ibm.com \
--cc=calvin@wbinvd.org \
--cc=casey@schaufler-ca.com \
--cc=cassel@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=christian.koenig@amd.com \
--cc=corbet@lwn.net \
--cc=corey@minyard.net \
--cc=davem@davemloft.net \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=edumazet@google.com \
--cc=freedreno@lists.freedesktop.org \
--cc=giometti@enneenne.com \
--cc=gor@linux.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=gustavo@padovan.org \
--cc=hca@linux.ibm.com \
--cc=hoeppner@linux.ibm.com \
--cc=hverkuil+cisco@kernel.org \
--cc=idryomov@gmail.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jesszhan0024@gmail.com \
--cc=jonathan.lemon@gmail.com \
--cc=kartilak@cisco.com \
--cc=kishon@kernel.org \
--cc=konradybcio@kernel.org \
--cc=kuba@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=linux@treblig.org \
--cc=lucas.demarchi@intel.com \
--cc=lumag@kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=maimon.sagi@gmail.com \
--cc=mani@kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=martin.petersen@oracle.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=matthew.brost@intel.com \
--cc=max.kellermann@ionos.com \
--cc=mchehab@kernel.org \
--cc=mhiramat@kernel.org \
--cc=mripard@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=openipmi-developer@lists.sourceforge.net \
--cc=pabeni@redhat.com \
--cc=pmladek@suse.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=richardcochran@gmail.com \
--cc=robin.clark@oss.qualcomm.com \
--cc=rodrigo.vivi@intel.com \
--cc=rostedt@goodmis.org \
--cc=satishkh@cisco.com \
--cc=sean@poorly.run \
--cc=sebaddel@cisco.com \
--cc=senozhatsky@chromium.org \
--cc=simona@ffwll.ch \
--cc=sth@linux.ibm.com \
--cc=sumit.semwal@linaro.org \
--cc=svens@linux.ibm.com \
--cc=thomas.hellstrom@linux.intel.com \
--cc=tzimmermann@suse.de \
--cc=ulf.hansson@linaro.org \
--cc=vadim.fedorenko@linux.dev \
--cc=vitaly.lifshits@intel.com \
--cc=xiubli@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).