Re: [PATCH] remove extern inline from quotaops.h

Denis Vlasenko (vda@port.imtp.ilyichevsk.odessa.ua)
Wed, 6 Nov 2002 18:11:19 -0200


On 4 November 2002 19:13, Andreas Dilger wrote:
> We are having a strange problem with compiling ext3 code out-of-tree,
> and it is related to the fact that several functions in quotaops.h
> are declared "extern __inline__" instead of "static inline". Is
> there a good reason to have it that way? I thought "extern
> __inline__" was sort of frowned upon.
>
> Below is a patch to change this to "static inline". A similar patch
> is needed for 2.5, but the file has changed significantly...

What is your gcc version?

Mine is 3.2, and it sometimes de-inline large inline functions.
That is, static inlines turn into simple static. And extern inlines
in dangling extern references, that's what bite you maybe ;)

Do not blindly fix it, think of it as a warning:
"gcc: your inline is too large"

For example,

static __inline__ int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
{
lock_kernel();
if (sb_any_quota_enabled(inode->i_sb)) {
/* Used space is updated in alloc_space() */
if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA) {
unlock_kernel();
return 1;
}
}
else
inode_add_bytes(inode, nr);
unlock_kernel();
return 0;
}

static __inline__ int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr)
{
int ret;
if (!(ret = DQUOT_ALLOC_SPACE_NODIRTY(inode, nr)))
mark_inode_dirty(inode);
return ret;
}

Don't you think DQUOT_ALLOC_SPACE is _way too large_ to inline?
Did you look at generated assembly to get a feeling of it's size?

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