[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <560f56f4-fb6d-6c78-6080-fe32df9ac4bf@huawei.com>
Date: Wed, 31 Jul 2019 21:30:04 +0800
From: Gao Xiang <gaoxiang25@...wei.com>
To: Jan Kara <jack@...e.cz>
CC: Alexander Viro <viro@...iv.linux.org.uk>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Theodore Ts'o <tytso@....edu>,
"David Sterba" <dsterba@...e.cz>,
Amir Goldstein <amir73il@...il.com>,
"Christoph Hellwig" <hch@...radead.org>,
"Darrick J . Wong" <darrick.wong@...cle.com>,
Dave Chinner <david@...morbit.com>,
Jaegeuk Kim <jaegeuk@...nel.org>,
"Linus Torvalds" <torvalds@...ux-foundation.org>,
<linux-fsdevel@...r.kernel.org>, <devel@...verdev.osuosl.org>,
LKML <linux-kernel@...r.kernel.org>,
<linux-erofs@...ts.ozlabs.org>, Chao Yu <yuchao0@...wei.com>,
Miao Xie <miaoxie@...wei.com>,
Li Guifu <bluce.liguifu@...wei.com>,
Fang Wei <fangwei1@...wei.com>
Subject: Re: [PATCH v5 12/24] erofs: introduce tagged pointer
On 2019/7/31 21:20, Gao Xiang wrote:
> Yes, I think that is about coding style, but the legacy way we have to do
> type cast as well, I think...
>
> struct b *ptr = tagptr_unfold_tags(tptr);
> vs
> struct b *ptr = (struct b *)((unsigned long)tptr & ~2);
and we could do "typedef tagptr1_t tptrb;" and then use tptrb for tagged
pointer rather than barely use tagptr1_t tagptr2_t ... as I mentioned in:
https://lore.kernel.org/lkml/0c2cdd4f-8fe7-6084-9c2d-c2e475e6806e@aol.com/
I think "tptrb" is enough for developers to know the original pointer type
when they coding...
OTOH, I think it could be better not to directly use "struct b *" to
represent the whole tagged pointer since it seems unsafe to do dereference
directly.. It could introduce some potential bugs...
All in all, this approach is only used for EROFS for now... If there are
some better implementation, I can switch to it in the later version :)
Thanks,
Gao Xiang
Powered by blists - more mailing lists