Re: [GIT PULL] y2038 changes for vfs
From: Linus Torvalds
Date: Tue May 24 2016 - 18:44:20 EST
On Tue, May 24, 2016 at 3:23 PM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> Just as an example: code that does
>
> dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
>
> could pretty mechanically be converted to
>
> dir->i_mtime = dir->i_ctime = current_fs_time(sb);
Actually, looking at the users, most of them don't have the superblock
directly as a variable, so it might be better to just make
current_fs_time() take the inode pointer instead.
That would make the conversion simpler, and it can then do the
inode->i_sb thing when it is converted to actually take the filesystem
limits and time granularity into account.
I suspect you could do 95% with a fairly simply coccinelle script. Or
even just use 'sed', with something like
sed 's/\([a-z]*\)->i_\([amc]\)time = CURRENT_TIME_SEC/\1->i_\2time =
current_fs_time(\1)/'
seems to get close.
Run that over the tree, fix up the few cases it doesn't catch, remove
the broken CURRENT_TIME_SEC thing, and voilÃ, you're pretty much done.
No?
Linus