Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1430997

Re: [PATCH v2 06/24] fs: ext4: Use current_time() for inode timestamps

From Deepa Dinamani <deepa.kernel@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 06/24] fs: ext4: Use current_time() for inode timestamps
Date 2016-06-25 01:10 +0200
Message-ID <rNIox-67c-3@gated-at.bofh.it> (permalink)
References <rLVgd-11C-1@gated-at.bofh.it> <rLVgd-11C-9@gated-at.bofh.it> <rMQxQ-44t-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


>> @@ -3727,6 +3727,7 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
>>         };
>>         u8 new_file_type;
>>         int retval;
>> +       struct timespec ctime;
>>
>>         if ((ext4_encrypted_inode(old_dir) ||
>>              ext4_encrypted_inode(new_dir)) &&
>> @@ -3829,8 +3830,9 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
>>          * Like most other Unix systems, set the ctime for inodes on a
>>          * rename.
>>          */
>> -       old.inode->i_ctime = ext4_current_time(old.inode);
>> -       new.inode->i_ctime = ext4_current_time(new.inode);
>> +       ctime = current_time(old.inode);
>> +       old.inode->i_ctime = ctime;
>> +       new.inode->i_ctime = ctime;
>>         ext4_mark_inode_dirty(handle, old.inode);
>>         ext4_mark_inode_dirty(handle, new.inode);
>>
>
> Adding a local variable here looks like it is going to cause us trouble when we
> change the return type of current_time() to timespec64.
>
> I'd write this as
>
>         new.inode->i_ctime = old.inode->i_ctime;
>
> instead.

This should be fine.
There are already instances that use local timespecs for inode time assignments.

These can be changed this way:

+       ctime = vfs_time_to_timespec(current_time(old.inode));
+       old.inode->i_ctime = timespec_to_vfs_time(ctime);
+       new.inode->i_ctime = timespec_to_vfs_time(ctime);

This could be a little inefficient, but only temporary.
The local variable can be changed to timespec64 when the macros are deleted.

I'm trying to make minimal changes.

-Deepa

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH v2 06/24] fs: ext4: Use current_time() for inode timestamps Deepa Dinamani <deepa.kernel@gmail.com> - 2016-06-25 01:10 +0200

csiph-web