From: Masami Hiramatsu (Google) <mhiramat@kernel.org> To: Pavan Kondeti <quic_pkondeti@quicinc.com> Cc: Mukesh Ojha <quic_mojha@quicinc.com>, <jaegeuk@kernel.org>, <chao@kernel.org>, <mhiramat@kernel.org>, <linux-f2fs-devel@lists.sourceforge.net>, <linux-kernel@vger.kernel.org> Subject: Re: [PATCH] f2fs: fix the assign logic of iocb Date: Mon, 24 Oct 2022 14:07:30 +0900 [thread overview] Message-ID: <20221024140730.904089a5736f9fe3d6893ccc@kernel.org> (raw) In-Reply-To: <20221021050046.GA31858@hu-pkondeti-hyd.qualcomm.com> On Fri, 21 Oct 2022 10:30:46 +0530 Pavan Kondeti <quic_pkondeti@quicinc.com> wrote: > Hi Mukesh, > > On Wed, Oct 19, 2022 at 09:47:57PM +0530, Mukesh Ojha wrote: > > commit 18ae8d12991b ("f2fs: show more DIO information in tracepoint") > > introduces iocb field in 'f2fs_direct_IO_enter' trace event > > And it only assigns the pointer and later it accesses its field > > in trace print log. > > > > Fix it by correcting data type and memcpy the content of iocb. > > > > Fixes: 18ae8d12991b ("f2fs: show more DIO information in tracepoint") > > Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com> > > --- > > include/trace/events/f2fs.h | 10 +++++----- > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h > > index c6b3724..7727ec9 100644 > > --- a/include/trace/events/f2fs.h > > +++ b/include/trace/events/f2fs.h > > @@ -940,7 +940,7 @@ TRACE_EVENT(f2fs_direct_IO_enter, > > TP_STRUCT__entry( > > __field(dev_t, dev) > > __field(ino_t, ino) > > - __field(struct kiocb *, iocb) > > + __field_struct(struct kiocb, iocb) > > __field(unsigned long, len) > > __field(int, rw) > > ), > > @@ -948,17 +948,17 @@ TRACE_EVENT(f2fs_direct_IO_enter, > > TP_fast_assign( > > __entry->dev = inode->i_sb->s_dev; > > __entry->ino = inode->i_ino; > > - __entry->iocb = iocb; > > + memcpy(&__entry->iocb, iocb, sizeof(*iocb)); > > __entry->len = len; > > __entry->rw = rw; > > ), > > > > Why copy the whole structure (48 bytes)? cache the three members you > need. +1. If this only prints ki_pos, ki_flags and ki_ioprio, I recommend you to save those 3 fields to the entry. It should not expose in-kernel data structure because it can be changed. Thank you, > > Thanks, > Pavan -- Masami Hiramatsu (Google) <mhiramat@kernel.org>
WARNING: multiple messages have this Message-ID (diff)
From: Masami Hiramatsu (Google) <mhiramat@kernel.org> To: Pavan Kondeti <quic_pkondeti@quicinc.com> Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Mukesh Ojha <quic_mojha@quicinc.com>, jaegeuk@kernel.org, mhiramat@kernel.org Subject: Re: [f2fs-dev] [PATCH] f2fs: fix the assign logic of iocb Date: Mon, 24 Oct 2022 14:07:30 +0900 [thread overview] Message-ID: <20221024140730.904089a5736f9fe3d6893ccc@kernel.org> (raw) In-Reply-To: <20221021050046.GA31858@hu-pkondeti-hyd.qualcomm.com> On Fri, 21 Oct 2022 10:30:46 +0530 Pavan Kondeti <quic_pkondeti@quicinc.com> wrote: > Hi Mukesh, > > On Wed, Oct 19, 2022 at 09:47:57PM +0530, Mukesh Ojha wrote: > > commit 18ae8d12991b ("f2fs: show more DIO information in tracepoint") > > introduces iocb field in 'f2fs_direct_IO_enter' trace event > > And it only assigns the pointer and later it accesses its field > > in trace print log. > > > > Fix it by correcting data type and memcpy the content of iocb. > > > > Fixes: 18ae8d12991b ("f2fs: show more DIO information in tracepoint") > > Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com> > > --- > > include/trace/events/f2fs.h | 10 +++++----- > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h > > index c6b3724..7727ec9 100644 > > --- a/include/trace/events/f2fs.h > > +++ b/include/trace/events/f2fs.h > > @@ -940,7 +940,7 @@ TRACE_EVENT(f2fs_direct_IO_enter, > > TP_STRUCT__entry( > > __field(dev_t, dev) > > __field(ino_t, ino) > > - __field(struct kiocb *, iocb) > > + __field_struct(struct kiocb, iocb) > > __field(unsigned long, len) > > __field(int, rw) > > ), > > @@ -948,17 +948,17 @@ TRACE_EVENT(f2fs_direct_IO_enter, > > TP_fast_assign( > > __entry->dev = inode->i_sb->s_dev; > > __entry->ino = inode->i_ino; > > - __entry->iocb = iocb; > > + memcpy(&__entry->iocb, iocb, sizeof(*iocb)); > > __entry->len = len; > > __entry->rw = rw; > > ), > > > > Why copy the whole structure (48 bytes)? cache the three members you > need. +1. If this only prints ki_pos, ki_flags and ki_ioprio, I recommend you to save those 3 fields to the entry. It should not expose in-kernel data structure because it can be changed. Thank you, > > Thanks, > Pavan -- Masami Hiramatsu (Google) <mhiramat@kernel.org> _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2022-10-24 5:07 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-19 16:17 [PATCH] f2fs: fix the assign logic of iocb Mukesh Ojha 2022-10-19 16:17 ` [f2fs-dev] " Mukesh Ojha 2022-10-20 9:01 ` Chao Yu 2022-10-20 9:01 ` [f2fs-dev] " Chao Yu 2022-10-20 9:27 ` Mukesh Ojha 2022-10-20 9:27 ` [f2fs-dev] " Mukesh Ojha 2022-10-20 10:26 ` Chao Yu 2022-10-20 10:26 ` [f2fs-dev] " Chao Yu 2022-10-21 5:00 ` Pavan Kondeti 2022-10-21 5:00 ` [f2fs-dev] " Pavan Kondeti 2022-10-24 5:07 ` Masami Hiramatsu [this message] 2022-10-24 5:07 ` Masami Hiramatsu
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=20221024140730.904089a5736f9fe3d6893ccc@kernel.org \ --to=mhiramat@kernel.org \ --cc=chao@kernel.org \ --cc=jaegeuk@kernel.org \ --cc=linux-f2fs-devel@lists.sourceforge.net \ --cc=linux-kernel@vger.kernel.org \ --cc=quic_mojha@quicinc.com \ --cc=quic_pkondeti@quicinc.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.