Whamcloud - gitweb
LU-11071 build: Add server build support for Ubuntu 18.04
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ubuntu18 / ext4-nocmtime.patch
1 We won't change i_xtime in ldiskfs code path. But also
2 need keep normal function out of Lustre. So we using
3 S_NOCMTIME to indicate invoked from Lustre.
4
5 Index: linux-4.15.0/fs/ext4/ext4.h
6 ===================================================================
7 --- linux-4.15.0.orig/fs/ext4/ext4.h
8 +++ linux-4.15.0/fs/ext4/ext4.h
9 @@ -655,6 +655,20 @@ enum {
10  #define EXT4_GOING_FLAGS_LOGFLUSH              0x1     /* flush log but not data */
11  #define EXT4_GOING_FLAGS_NOLOGFLUSH            0x2     /* don't flush log nor data */
12  
13 +#define current_time(a) ext4_current_time(a)
14 +static inline struct timespec ext4_current_time(struct inode *inode)
15 +{
16 +       struct timespec now = current_kernel_time();
17 +
18 +       if (IS_NOCMTIME(inode))
19 +               return inode->i_ctime;
20 +
21 +       /* Copy from fs/inode.c */
22 +       if (unlikely(!inode->i_sb))
23 +               return now;
24 +
25 +       return timespec_trunc(now, inode->i_sb->s_time_gran);
26 +}
27  
28  #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
29  /*