Re: [PATCH 1/1] fs/ext2: Avoid page_address on pages returned by ext2_get_page

From: Jan Kara
Date: Wed Jul 14 2021 - 05:00:17 EST


On Tue 13-07-21 19:33:19, Javier Pello wrote:
> On Tue, 13 Jul 2021 18:30:18, Jan Kara wrote:
> > > @@ -584,16 +584,16 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode)
> > > * ext2_delete_entry deletes a directory entry by merging it with the
> > > * previous entry. Page is up-to-date.
> > > */
> > > -int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page )
> > > +int ext2_delete_entry (struct ext2_dir_entry_2 *dir, struct page *page,
> > > + void *kaddr)
> >
> > Why not have 'kaddr' as char *. We type it to char * basically everywhere
> > anyway.
>
> I thought about that, as well, but in the end I leaned towards void *
> because it is a generic pointer, conceptually. Would you rather have it
> be char *?

Well, it depends on how you look at it. We can also think of kaddr as a
start of buffer 'dir' is pointing to. Anyway given this is not some generic
function but a very targetted one with only a few call sites I'd just lean
towards making our life easy and making kaddr char *.

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR