All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: make online defrag error reporting consistent
@ 2015-06-17 16:40 Eric Whitney
  2015-06-17 17:15 ` Darrick J. Wong
  2015-06-22  1:43 ` Theodore Ts'o
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Whitney @ 2015-06-17 16:40 UTC (permalink / raw)
  To: linux-ext4; +Cc: tytso

Make the error reporting behavior resulting from the unsupported use
of online defrag on files with data journaling enabled consistent with
that implemented for bigalloc file systems. Difference found with
ext4/308.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
---
 fs/ext4/move_extent.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index 8c04afb..fb6f117 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -571,12 +571,16 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk,
 			orig_inode->i_ino, donor_inode->i_ino);
 		return -EINVAL;
 	}
-	/* TODO: This is non obvious task to swap blocks for inodes with full
-	   jornaling enabled */
+
+	/* TODO: it's not obvious how to swap blocks for inodes with full
+	   journaling enabled */
 	if (ext4_should_journal_data(orig_inode) ||
 	    ext4_should_journal_data(donor_inode)) {
-		return -EINVAL;
+		ext4_msg(orig_inode->i_sb, KERN_ERR,
+			 "Online defrag not supported with data journaling");
+		return -EOPNOTSUPP;
 	}
+
 	/* Protect orig and donor inodes against a truncate */
 	lock_two_nondirectories(orig_inode, donor_inode);
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ext4: make online defrag error reporting consistent
  2015-06-17 16:40 [PATCH] ext4: make online defrag error reporting consistent Eric Whitney
@ 2015-06-17 17:15 ` Darrick J. Wong
  2015-06-17 18:02   ` Eric Whitney
  2015-06-22  1:43 ` Theodore Ts'o
  1 sibling, 1 reply; 5+ messages in thread
From: Darrick J. Wong @ 2015-06-17 17:15 UTC (permalink / raw)
  To: Eric Whitney; +Cc: linux-ext4, tytso

On Wed, Jun 17, 2015 at 12:40:35PM -0400, Eric Whitney wrote:
> Make the error reporting behavior resulting from the unsupported use
> of online defrag on files with data journaling enabled consistent with
> that implemented for bigalloc file systems. Difference found with
> ext4/308.
> 
> Signed-off-by: Eric Whitney <enwlinux@gmail.com>
> ---
>  fs/ext4/move_extent.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
> index 8c04afb..fb6f117 100644
> --- a/fs/ext4/move_extent.c
> +++ b/fs/ext4/move_extent.c
> @@ -571,12 +571,16 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk,
>  			orig_inode->i_ino, donor_inode->i_ino);
>  		return -EINVAL;
>  	}
> -	/* TODO: This is non obvious task to swap blocks for inodes with full
> -	   jornaling enabled */
> +
> +	/* TODO: it's not obvious how to swap blocks for inodes with full
> +	   journaling enabled */
>  	if (ext4_should_journal_data(orig_inode) ||
>  	    ext4_should_journal_data(donor_inode)) {
> -		return -EINVAL;
> +		ext4_msg(orig_inode->i_sb, KERN_ERR,
> +			 "Online defrag not supported with data journaling");
> +		return -EOPNOTSUPP;
>  	}
> +

One minor nit: If it's solely the donor_inode that's data=journal (i.e. we
didn't mount with data=journal and only the donor inode is chattr +j), the
inode number reported in the message will be inaccurate.

I'm not sure why you'd chattr +j only the donor inode, so in practice this
isn't likely to occur.

Other than that,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

>  	/* Protect orig and donor inodes against a truncate */
>  	lock_two_nondirectories(orig_inode, donor_inode);
>  
> -- 
> 2.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ext4: make online defrag error reporting consistent
  2015-06-17 17:15 ` Darrick J. Wong
@ 2015-06-17 18:02   ` Eric Whitney
  2015-06-17 18:04     ` Darrick J. Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Whitney @ 2015-06-17 18:02 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Eric Whitney, linux-ext4, tytso

* Darrick J. Wong <darrick.wong@oracle.com>:
> On Wed, Jun 17, 2015 at 12:40:35PM -0400, Eric Whitney wrote:
> > Make the error reporting behavior resulting from the unsupported use
> > of online defrag on files with data journaling enabled consistent with
> > that implemented for bigalloc file systems. Difference found with
> > ext4/308.
> > 
> > Signed-off-by: Eric Whitney <enwlinux@gmail.com>
> > ---
> >  fs/ext4/move_extent.c | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> > 
> > diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
> > index 8c04afb..fb6f117 100644
> > --- a/fs/ext4/move_extent.c
> > +++ b/fs/ext4/move_extent.c
> > @@ -571,12 +571,16 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk,
> >  			orig_inode->i_ino, donor_inode->i_ino);
> >  		return -EINVAL;
> >  	}
> > -	/* TODO: This is non obvious task to swap blocks for inodes with full
> > -	   jornaling enabled */
> > +
> > +	/* TODO: it's not obvious how to swap blocks for inodes with full
> > +	   journaling enabled */
> >  	if (ext4_should_journal_data(orig_inode) ||
> >  	    ext4_should_journal_data(donor_inode)) {
> > -		return -EINVAL;
> > +		ext4_msg(orig_inode->i_sb, KERN_ERR,
> > +			 "Online defrag not supported with data journaling");
> > +		return -EOPNOTSUPP;
> >  	}
> > +
> 
> One minor nit: If it's solely the donor_inode that's data=journal (i.e. we
> didn't mount with data=journal and only the donor inode is chattr +j), the
> inode number reported in the message will be inaccurate.
> 
> I'm not sure why you'd chattr +j only the donor inode, so in practice this
> isn't likely to occur.
> 
> Other than that,
> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> 

The message reports the file system's device rather than an inode number
in this case.  Code above this snippet verified that the original and
donor inodes were from the same file system, so hopefully the reported
device will be correct even if only the donor inode is chattr +j.
Unless I'm missing something, of course...

Thanks for the review!
Eric


> --D
> 
> >  	/* Protect orig and donor inodes against a truncate */
> >  	lock_two_nondirectories(orig_inode, donor_inode);
> >  
> > -- 
> > 2.1.4
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ext4: make online defrag error reporting consistent
  2015-06-17 18:02   ` Eric Whitney
@ 2015-06-17 18:04     ` Darrick J. Wong
  0 siblings, 0 replies; 5+ messages in thread
From: Darrick J. Wong @ 2015-06-17 18:04 UTC (permalink / raw)
  To: Eric Whitney; +Cc: linux-ext4, tytso

On Wed, Jun 17, 2015 at 02:02:42PM -0400, Eric Whitney wrote:
> * Darrick J. Wong <darrick.wong@oracle.com>:
> > On Wed, Jun 17, 2015 at 12:40:35PM -0400, Eric Whitney wrote:
> > > Make the error reporting behavior resulting from the unsupported use
> > > of online defrag on files with data journaling enabled consistent with
> > > that implemented for bigalloc file systems. Difference found with
> > > ext4/308.
> > > 
> > > Signed-off-by: Eric Whitney <enwlinux@gmail.com>
> > > ---
> > >  fs/ext4/move_extent.c | 10 +++++++---
> > >  1 file changed, 7 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
> > > index 8c04afb..fb6f117 100644
> > > --- a/fs/ext4/move_extent.c
> > > +++ b/fs/ext4/move_extent.c
> > > @@ -571,12 +571,16 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk,
> > >  			orig_inode->i_ino, donor_inode->i_ino);
> > >  		return -EINVAL;
> > >  	}
> > > -	/* TODO: This is non obvious task to swap blocks for inodes with full
> > > -	   jornaling enabled */
> > > +
> > > +	/* TODO: it's not obvious how to swap blocks for inodes with full
> > > +	   journaling enabled */
> > >  	if (ext4_should_journal_data(orig_inode) ||
> > >  	    ext4_should_journal_data(donor_inode)) {
> > > -		return -EINVAL;
> > > +		ext4_msg(orig_inode->i_sb, KERN_ERR,
> > > +			 "Online defrag not supported with data journaling");
> > > +		return -EOPNOTSUPP;
> > >  	}
> > > +
> > 
> > One minor nit: If it's solely the donor_inode that's data=journal (i.e. we
> > didn't mount with data=journal and only the donor inode is chattr +j), the
> > inode number reported in the message will be inaccurate.
> > 
> > I'm not sure why you'd chattr +j only the donor inode, so in practice this
> > isn't likely to occur.
> > 
> > Other than that,
> > Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> 
> The message reports the file system's device rather than an inode number
> in this case.  Code above this snippet verified that the original and
> donor inodes were from the same file system, so hopefully the reported
> device will be correct even if only the donor inode is chattr +j.
> Unless I'm missing something, of course...

inode->i_sb ==> superblock, d'oh!

You're right, I misread that expression for the inode number, ignore my
noise. :)

--D

> 
> Thanks for the review!
> Eric
> 
> 
> > --D
> > 
> > >  	/* Protect orig and donor inodes against a truncate */
> > >  	lock_two_nondirectories(orig_inode, donor_inode);
> > >  
> > > -- 
> > > 2.1.4
> > > 
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ext4: make online defrag error reporting consistent
  2015-06-17 16:40 [PATCH] ext4: make online defrag error reporting consistent Eric Whitney
  2015-06-17 17:15 ` Darrick J. Wong
@ 2015-06-22  1:43 ` Theodore Ts'o
  1 sibling, 0 replies; 5+ messages in thread
From: Theodore Ts'o @ 2015-06-22  1:43 UTC (permalink / raw)
  To: Eric Whitney; +Cc: linux-ext4

On Wed, Jun 17, 2015 at 12:40:35PM -0400, Eric Whitney wrote:
> Make the error reporting behavior resulting from the unsupported use
> of online defrag on files with data journaling enabled consistent with
> that implemented for bigalloc file systems. Difference found with
> ext4/308.
> 
> Signed-off-by: Eric Whitney <enwlinux@gmail.com>

Applied, thanks.

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-06-22  1:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-17 16:40 [PATCH] ext4: make online defrag error reporting consistent Eric Whitney
2015-06-17 17:15 ` Darrick J. Wong
2015-06-17 18:02   ` Eric Whitney
2015-06-17 18:04     ` Darrick J. Wong
2015-06-22  1:43 ` Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.