mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Wengang Wang <wen.gang.wang@oracle.com>
Cc: "ocfs2-devel@lists.linux.dev" <ocfs2-devel@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ocfs2: update seq_file index in ocfs2_dlm_seq_next
Date: Mon, 11 Nov 2024 17:35:49 +0800	[thread overview]
Message-ID: <6c468b6c-c449-444d-90af-fd2a6c7c1993@linux.alibaba.com> (raw)
In-Reply-To: <72E849B5-ECE7-4304-AF90-A60784B4EEFF@oracle.com>



On 11/11/24 3:04 PM, Wengang Wang wrote:
> 
> 
>> On Nov 10, 2024, at 5:38 PM, Joseph Qi <joseph.qi@linux.alibaba.com> wrote:
>>
>>
>>
>> On 11/9/24 3:28 AM, Wengang Wang wrote:
>>> The following INFO level message was seen:
>>>
>>> seq_file: buggy .next function ocfs2_dlm_seq_next [ocfs2] did not
>>> update position index
>>>
>>> Fix:
>>> Updata m->index to make seq_read_iter happy though the index its self makes
>>> no sense to ocfs2_dlm_seq_next.
>>>
>>> Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
>>> ---
>>> fs/ocfs2/dlmglue.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
>>> index 60df52e4c1f8..349d131369cf 100644
>>> --- a/fs/ocfs2/dlmglue.c
>>> +++ b/fs/ocfs2/dlmglue.c
>>> @@ -3120,6 +3120,7 @@ static void *ocfs2_dlm_seq_next(struct seq_file *m, void *v, loff_t *pos)
>>> }
>>> spin_unlock(&ocfs2_dlm_tracking_lock);
>>>
>>> + m->index++;
>>
>> We can directly use '(*pos)++' instead.
>>
> 
> The input/output "pos” indicates more an offset into the file. Actually the output for an item is not really 1 byte in length, so incrementing the offset by 1 sounds a bit strange to me. Instead If we increment the “index”, It would be easier to understand it as  for next item. Though updating “index” or updating “*pos” instead makes no difference to binary running, the code understanding is different.  I know other seq_operations.next functions are directly incrementing the “*pos”, I think updating “index” is better. Well, if you persist (*pos)++, I will also let it go.
> 
From seq_read_iter(), the input pos is equivalent to '&m->index'. So the
above two ways seems have no functional difference.
IMO, we'd better hide the m->index logic into seqfile and just use pos
instead like other .next implementations.

Thanks,
Joseph


  reply	other threads:[~2024-11-11  9:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20241108192829.58813-1-wen.gang.wang@oracle.com>
2024-11-11  1:38 ` Joseph Qi
2024-11-11  7:04   ` Wengang Wang
2024-11-11  9:35     ` Joseph Qi [this message]
2025-02-14 23:55       ` Andrew Morton
2025-02-15  0:23         ` Wengang Wang

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=6c468b6c-c449-444d-90af-fd2a6c7c1993@linux.alibaba.com \
    --to=joseph.qi@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ocfs2-devel@lists.linux.dev \
    --cc=wen.gang.wang@oracle.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

all inboxes | Powered by JetHome®