From: Zhihao Cheng <chengzhihao1@huawei.com>
To: Adarsh Das <adarshdas950@gmail.com>
Cc: <dwmw2@infradead.org>, <richard@nod.at>,
<linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] jffs2: use fs_umode_to_dtype() for dirent type
Date: Sat, 7 Feb 2026 15:59:44 +0800 [thread overview]
Message-ID: <6fed1bb5-7d9a-c60d-f243-4e06d29c8af8@huawei.com> (raw)
In-Reply-To: <20260207073948.48144-1-adarshdas950@gmail.com>
在 2026/2/7 15:39, Adarsh Das 写道:
> Hi Zhihao,
>
> Thank you for taking the time to review my patch!
>
> I'm trying to understand the issue you've identified. I looked at the
> fs_umode_to_dtype() implementation in fs/fs_types.c:
>
> unsigned char fs_umode_to_dtype(umode_t mode) {
> return fs_ftype_to_dtype(fs_umode_to_ftype(mode));
> }
>
>>From what I can see, it seems like the function does produce FT_FIFO (5)
> as an intermediate value, but then converts it back before returning.
> Here's what I think happens for S_IFIFO (0010000):
>
> Old bit-shift code:
> type = (mode & S_IFMT) >> 12
> = (0010000 & 00170000) >> 12
> = 0010000 >> 12
> = 1 (DT_FIFO)
>
> New fs_umode_to_dtype() code:
> Step 1: fs_umode_to_ftype(0010000)
> = fs_ftype_by_dtype[S_DT(0010000)]
> = fs_ftype_by_dtype[1]
> = FT_FIFO = 5
>
> Step 2: fs_ftype_to_dtype(5)
> = fs_dtype_by_ftype[5]
> = DT_FIFO = 1
>
Oh, that's fs_umode_to_dtype, sorry for the mistake, I saw it as
'fs_umode_to_ftype'.
> I'm not sure how FT_FIFO (5) would remain after the function returns, since
> it seems to get converted back to DT_FIFO (1) in step 2.
>
> If there's an issue with this approach, I can edit my patch and keep changes in only jffs2_mknod.
> .
>
next prev parent reply other threads:[~2026-02-07 7:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-06 11:51 Adarsh Das
2026-02-07 2:36 ` Zhihao Cheng
2026-02-07 7:39 ` Adarsh Das
2026-02-07 7:59 ` Zhihao Cheng [this message]
2026-02-07 8:00 ` Zhihao Cheng
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=6fed1bb5-7d9a-c60d-f243-4e06d29c8af8@huawei.com \
--to=chengzhihao1@huawei.com \
--cc=adarshdas950@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
/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®