lkml.org 
[lkml]   [2000]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] get_empty_inode() cleanup
On Thu, 16 Nov 2000, Alexander Viro wrote:

> Almost all (== all filesystem and then some) callers of
> get_empty_inode() follow it with
> inode->i_sb = some_sb;
> inode->i_dev = some_sb->s_dev;
> Some of them do it twice for no good reason (assign the same value,
> even though neither ->i_sb nor ->i_dev could change in interval).
> Some of them duplicate the initializations already done by get_empty_inode()
> (e.g. ->i_size to 0, ->i_nlink to 1, etc.).
>
> Patch below adds an inlined function
> struct inode *new_inode(struct super_block *sb)
> {
> struct inode *inode = get_empty_inode();
> if (inode) {
> inode->i_sb = sb;
> inode->i_dev = sb->s_dev;
> }
> return inode;
> }

Alexander,

IMHO, instead of adding a new function, it is cleaner to just add the 'sb'
argument to get_empty_inode() and those who do not wish to pass it should
just pass NULL. Checking if(sb) inside it is easier than making yet
another function call, maybe.

Regards,
Tigran

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:47    [W:0.394 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site