diff mbox series

[11/22] ext4: over ride current_time

Message ID 1563758631-29550-12-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series ldiskfs patches against 5.2-rc2+ | expand

Commit Message

James Simmons July 22, 2019, 1:23 a.m. UTC
return i_ctime if IS_NOCMTIME is true for inode.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/ext4/ext4.h | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

NeilBrown July 22, 2019, 5:06 a.m. UTC | #1
On Sun, Jul 21 2019, James Simmons wrote:

> return i_ctime if IS_NOCMTIME is true for inode.

So ... this prevents ext4 from ever changing the i_ctime
on any file with S_NOCMTIME set - and osd-ldiskfs sets that on
all inodes.

Presumably osd wants full control of the ctime.

That's probably a reasonable goal.  I think it should be achieved by
adding a mount/sb flag which suppresses all m/ctime updates except those
made through utimes().

NeilBrown


>
> Signed-off-by: James Simmons <jsimmons@infradead.org>
> ---
>  fs/ext4/ext4.h | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 51b6159..80601a9 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -661,6 +661,13 @@ enum {
>  #define EXT4_GOING_FLAGS_LOGFLUSH		0x1	/* flush log but not data */
>  #define EXT4_GOING_FLAGS_NOLOGFLUSH		0x2	/* don't flush log nor data */
>  
> +static inline struct timespec64 ext4_current_time(struct inode *inode)
> +{
> +	if (IS_NOCMTIME(inode))
> +		return inode->i_ctime;
> +	return current_time(inode);
> +}
> +#define current_time(a) ext4_current_time(a)
>  
>  #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
>  /*
> -- 
> 1.8.3.1
diff mbox series

Patch

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 51b6159..80601a9 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -661,6 +661,13 @@  enum {
 #define EXT4_GOING_FLAGS_LOGFLUSH		0x1	/* flush log but not data */
 #define EXT4_GOING_FLAGS_NOLOGFLUSH		0x2	/* don't flush log nor data */
 
+static inline struct timespec64 ext4_current_time(struct inode *inode)
+{
+	if (IS_NOCMTIME(inode))
+		return inode->i_ctime;
+	return current_time(inode);
+}
+#define current_time(a) ext4_current_time(a)
 
 #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
 /*