Re: [PATCH v5] fs: introduce is_dot_or_dotdot helper for cleanup

From: Matthew Wilcox
Date: Wed Dec 11 2019 - 08:40:34 EST


On Wed, Dec 11, 2019 at 03:17:11PM +0800, Gao Xiang wrote:
> > static inline bool is_dot_or_dotdot(const unsigned char *name, size_t len)
> > {
> > if (len >= 1 && unlikely(name[0] == '.')) {
>
>
> And I suggest drop "unlikely" here since files start with prefix
> '.' (plus specical ".", "..") are not as uncommon as you expected...

They absolutely are uncommon. Even if you just consider
/home/willy/kernel/linux/.git/config, only one of those six path elements
starts with a '.'.