diff mbox

btrfs_inode_item's otime?

Message ID 2188846.ArnMyWRJKN@quad (mailing list archive)
State Superseded
Headers show

Commit Message

Chris Samuel Jan. 8, 2015, 10:52 a.m. UTC
Hi Dave,

Sorry for the delay, took a while to poke around the code to figure
out possible ways it would get done (and what the right structure was).

On Tue, 6 Jan 2015 07:41:00 PM David Sterba wrote:

> Set the otime in btrfs_new_inode after the call to fill_inode_item.

Hmm, so something like this then?

Unfortunately I won't have a test system to try this on for a little while.

Comments

David Sterba Jan. 9, 2015, 4:11 p.m. UTC | #1
On Thu, Jan 08, 2015 at 09:52:30PM +1100, Chris Samuel wrote:
> Sorry for the delay, took a while to poke around the code to figure
> out possible ways it would get done (and what the right structure was).

No delay noticed :)

> > Set the otime in btrfs_new_inode after the call to fill_inode_item.
> Unfortunately I won't have a test system to try this on for a little while.
> 
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index e687bb0..60bcc72 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -5835,6 +5835,11 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
>                              sizeof(*inode_item));
>         fill_inode_item(trans, path->nodes[0], inode_item, inode);
>  
> +       /*
> +        * Set the creation time on the inode.
> +        */
> +       btrfs_set_stack_timespec_sec( &inode.otime, cur_time.tv_sec );

Drop the spaces after/before parens and also set usec the same way.
There's no such thing as 'current_time', only CURRENT_TIME but that
cannot be used directly as a structure.

Given that the mtime is set a few lines above, copy the tv_sec and
tv_usec from there.

> +
>         if (name) {
>                 ref = btrfs_item_ptr(path->nodes[0], path->slots[0] + 1,
>                                      struct btrfs_inode_ref);
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Sterba Jan. 15, 2015, 10:48 a.m. UTC | #2
On Fri, Jan 09, 2015 at 05:11:42PM +0100, David Sterba wrote:
> > --- a/fs/btrfs/inode.c
> > +++ b/fs/btrfs/inode.c
> > @@ -5835,6 +5835,11 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
> >                              sizeof(*inode_item));
> >         fill_inode_item(trans, path->nodes[0], inode_item, inode);
> >  
> > +       /*
> > +        * Set the creation time on the inode.
> > +        */
> > +       btrfs_set_stack_timespec_sec( &inode.otime, cur_time.tv_sec );
> 
> Drop the spaces after/before parens and also set usec the same way.
> There's no such thing as 'current_time', only CURRENT_TIME but that
> cannot be used directly as a structure.
> 
> Given that the mtime is set a few lines above, copy the tv_sec and
> tv_usec from there.

chandan pointed out on IRC the other day that he'd sent a patch for that
already

http://www.mail-archive.com/linux-btrfs%40vger.kernel.org/msg17508.html

Though the patch cannot be applied as-is, it's more complete (I've
missed a few places where the otime has to be set).

Chandan, please drop the btrfs_inode_otime helper and resend. Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chris Samuel Jan. 16, 2015, 4:47 a.m. UTC | #3
On 15/01/15 21:48, David Sterba wrote:

> Chandan, please drop the btrfs_inode_otime helper and resend. Thanks.

Thanks!

Sorry I'd had no further time to look at this, I've been fully committed
with $DAY_JOB and on a number of projects with our local community
observatory (if anyone is in/visiting Melbourne and into astronomy ping
me for details).

All the best,
Chris
diff mbox

Patch

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index e687bb0..60bcc72 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5835,6 +5835,11 @@  static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
                             sizeof(*inode_item));
        fill_inode_item(trans, path->nodes[0], inode_item, inode);
 
+       /*
+        * Set the creation time on the inode.
+        */
+       btrfs_set_stack_timespec_sec( &inode.otime, cur_time.tv_sec );
+
        if (name) {
                ref = btrfs_item_ptr(path->nodes[0], path->slots[0] + 1,
                                     struct btrfs_inode_ref);