public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Make inode64 a remountable option
@ 2012-08-16 18:35 Carlos Maiolino
  2012-08-16 20:23 ` Brian Foster
  2012-08-16 22:40 ` Dave Chinner
  0 siblings, 2 replies; 6+ messages in thread
From: Carlos Maiolino @ 2012-08-16 18:35 UTC (permalink / raw)
  To: xfs; +Cc: Carlos Maiolino

Actually, there is no reason about why a user must umount and mount a XFS
filesystem to enable 'inode64' option. So, this patch makes this a remountable
option.

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---
 fs/xfs/xfs_super.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index bdaf4cb..4dad567 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -120,12 +120,13 @@ mempool_t *xfs_ioend_pool;
  * in the future, too.
  */
 enum {
-	Opt_barrier, Opt_nobarrier, Opt_err
+	Opt_barrier, Opt_nobarrier, Opt_inode64, Opt_err
 };
 
 static const match_table_t tokens = {
 	{Opt_barrier, "barrier"},
 	{Opt_nobarrier, "nobarrier"},
+	{Opt_inode64, "inode64"},
 	{Opt_err, NULL}
 };
 
@@ -1038,11 +1039,15 @@ xfs_fs_remount(
 {
 	struct xfs_mount	*mp = XFS_M(sb);
 	substring_t		args[MAX_OPT_ARGS];
+	xfs_sb_t		*sbp = &(mp->m_sb);
+	xfs_perag_t		*pag;
 	char			*p;
 	int			error;
 
 	while ((p = strsep(&options, ",")) != NULL) {
 		int token;
+		int agcount = sbp->sb_agcount;
+		int index = 0;
 
 		if (!*p)
 			continue;
@@ -1055,6 +1060,17 @@ xfs_fs_remount(
 		case Opt_nobarrier:
 			mp->m_flags &= ~XFS_MOUNT_BARRIER;
 			break;
+		case Opt_inode64:
+
+			for (index = 0; index < agcount; index++) {
+				pag = xfs_perag_get(mp, index);
+				pag->pagi_inodeok = 1;
+				xfs_perag_put(pag);
+			}
+			mp->m_flags &= ~XFS_MOUNT_32BITINODES;
+			mp->m_flags &= ~XFS_MOUNT_SMALL_INUMS;
+			mp->m_maxagi = index;
+			break;
 		default:
 			/*
 			 * Logically we would return an error here to prevent
-- 
1.7.11.2

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] Make inode64 a remountable option
  2012-08-16 18:35 [PATCH] Make inode64 a remountable option Carlos Maiolino
@ 2012-08-16 20:23 ` Brian Foster
  2012-08-17  1:20   ` Carlos Maiolino
  2012-08-16 22:40 ` Dave Chinner
  1 sibling, 1 reply; 6+ messages in thread
From: Brian Foster @ 2012-08-16 20:23 UTC (permalink / raw)
  To: Carlos Maiolino; +Cc: xfs

On 08/16/2012 02:35 PM, Carlos Maiolino wrote:
> Actually, there is no reason about why a user must umount and mount a XFS
> filesystem to enable 'inode64' option. So, this patch makes this a remountable
> option.
> 
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>

I just gave it a whirl. It works and the code looks sane to me, so:

Reviewed-by: Brian Foster <bfoster@redhat.com>

I do have a question though... do we care about the remount from inode64
to non-inode64 case?

Brian

> ---
>  fs/xfs/xfs_super.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index bdaf4cb..4dad567 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -120,12 +120,13 @@ mempool_t *xfs_ioend_pool;
>   * in the future, too.
>   */
>  enum {
> -	Opt_barrier, Opt_nobarrier, Opt_err
> +	Opt_barrier, Opt_nobarrier, Opt_inode64, Opt_err
>  };
>  
>  static const match_table_t tokens = {
>  	{Opt_barrier, "barrier"},
>  	{Opt_nobarrier, "nobarrier"},
> +	{Opt_inode64, "inode64"},
>  	{Opt_err, NULL}
>  };
>  
> @@ -1038,11 +1039,15 @@ xfs_fs_remount(
>  {
>  	struct xfs_mount	*mp = XFS_M(sb);
>  	substring_t		args[MAX_OPT_ARGS];
> +	xfs_sb_t		*sbp = &(mp->m_sb);
> +	xfs_perag_t		*pag;
>  	char			*p;
>  	int			error;
>  
>  	while ((p = strsep(&options, ",")) != NULL) {
>  		int token;
> +		int agcount = sbp->sb_agcount;
> +		int index = 0;
>  
>  		if (!*p)
>  			continue;
> @@ -1055,6 +1060,17 @@ xfs_fs_remount(
>  		case Opt_nobarrier:
>  			mp->m_flags &= ~XFS_MOUNT_BARRIER;
>  			break;
> +		case Opt_inode64:
> +
> +			for (index = 0; index < agcount; index++) {
> +				pag = xfs_perag_get(mp, index);
> +				pag->pagi_inodeok = 1;
> +				xfs_perag_put(pag);
> +			}
> +			mp->m_flags &= ~XFS_MOUNT_32BITINODES;
> +			mp->m_flags &= ~XFS_MOUNT_SMALL_INUMS;
> +			mp->m_maxagi = index;
> +			break;
>  		default:
>  			/*
>  			 * Logically we would return an error here to prevent
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] Make inode64 a remountable option
  2012-08-16 18:35 [PATCH] Make inode64 a remountable option Carlos Maiolino
  2012-08-16 20:23 ` Brian Foster
@ 2012-08-16 22:40 ` Dave Chinner
  2012-08-17  0:46   ` Carlos Maiolino
  1 sibling, 1 reply; 6+ messages in thread
From: Dave Chinner @ 2012-08-16 22:40 UTC (permalink / raw)
  To: Carlos Maiolino; +Cc: xfs

On Thu, Aug 16, 2012 at 03:35:10PM -0300, Carlos Maiolino wrote:
> Actually, there is no reason about why a user must umount and mount a XFS
> filesystem to enable 'inode64' option. So, this patch makes this a remountable
> option.
> 
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> ---
>  fs/xfs/xfs_super.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index bdaf4cb..4dad567 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -120,12 +120,13 @@ mempool_t *xfs_ioend_pool;
>   * in the future, too.
>   */
>  enum {
> -	Opt_barrier, Opt_nobarrier, Opt_err
> +	Opt_barrier, Opt_nobarrier, Opt_inode64, Opt_err
>  };
>  
>  static const match_table_t tokens = {
>  	{Opt_barrier, "barrier"},
>  	{Opt_nobarrier, "nobarrier"},
> +	{Opt_inode64, "inode64"},
>  	{Opt_err, NULL}
>  };
>  
> @@ -1038,11 +1039,15 @@ xfs_fs_remount(
>  {
>  	struct xfs_mount	*mp = XFS_M(sb);
>  	substring_t		args[MAX_OPT_ARGS];
> +	xfs_sb_t		*sbp = &(mp->m_sb);
> +	xfs_perag_t		*pag;

No need for the xfs_sb_t declaration at all, and pag can be scoped
inside the inner loop. Also, we don't use the typedef versions
anymore...

>  	char			*p;
>  	int			error;
>  
>  	while ((p = strsep(&options, ",")) != NULL) {
>  		int token;
> +		int agcount = sbp->sb_agcount;
> +		int index = 0;

Similarly, there is no need for the agcount variable, and the first
loop indice is normally named "i".

>  
>  		if (!*p)
>  			continue;
> @@ -1055,6 +1060,17 @@ xfs_fs_remount(
>  		case Opt_nobarrier:
>  			mp->m_flags &= ~XFS_MOUNT_BARRIER;
>  			break;
> +		case Opt_inode64:
> +
> +			for (index = 0; index < agcount; index++) {
> +				pag = xfs_perag_get(mp, index);
> +				pag->pagi_inodeok = 1;
> +				xfs_perag_put(pag);
> +			}

This doesn't clear the pagf_metadata flag that is also set when
inode32 is active to reserve the inode AGs for metadata allocations
only. So the loop needs to look something like:

			for (i = 0; i < mp->m_sb.sb_agcount; i++) {
				struct xfs_perag *pag;

				pag = xfs_perag_get(mp, i);
				pag->pagi_inodeok = 1;
				pag->pagf_metadata = 0;
				xfs_perag_put(pag);
			}

> +			mp->m_flags &= ~XFS_MOUNT_32BITINODES;
> +			mp->m_flags &= ~XFS_MOUNT_SMALL_INUMS;

The usual way of clearing multiple flags is like so:

			mp->m_flags &= ~(XFS_MOUNT_32BITINODES |
					 XFS_MOUNT_SMALL_INUMS);

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] Make inode64 a remountable option
  2012-08-16 22:40 ` Dave Chinner
@ 2012-08-17  0:46   ` Carlos Maiolino
  0 siblings, 0 replies; 6+ messages in thread
From: Carlos Maiolino @ 2012-08-17  0:46 UTC (permalink / raw)
  To: xfs

> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com

Thanks Dave, I'll change these, and re-send a V2.

-- 
--Carlos

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] Make inode64 a remountable option
  2012-08-16 20:23 ` Brian Foster
@ 2012-08-17  1:20   ` Carlos Maiolino
  2012-08-17  1:42     ` Dave Chinner
  0 siblings, 1 reply; 6+ messages in thread
From: Carlos Maiolino @ 2012-08-17  1:20 UTC (permalink / raw)
  To: xfs

> Reviewed-by: Brian Foster <bfoster@redhat.com>
> 
> I do have a question though... do we care about the remount from inode64
> to non-inode64 case?
> 
I thought about it, but, once we enable inode64 option, remounting it back to
inode32 may create problems to access inodes greater than (1<<32) - 1, so, I
don't think we should make inode32 a remountable option.

My point of view though.
> > ---
> >  fs/xfs/xfs_super.c | 18 +++++++++++++++++-
> >  1 file changed, 17 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> > index bdaf4cb..4dad567 100644
> > --- a/fs/xfs/xfs_super.c
> > +++ b/fs/xfs/xfs_super.c
> > @@ -120,12 +120,13 @@ mempool_t *xfs_ioend_pool;
> >   * in the future, too.
> >   */
> >  enum {
> > -	Opt_barrier, Opt_nobarrier, Opt_err
> > +	Opt_barrier, Opt_nobarrier, Opt_inode64, Opt_err
> >  };
> >  
> >  static const match_table_t tokens = {
> >  	{Opt_barrier, "barrier"},
> >  	{Opt_nobarrier, "nobarrier"},
> > +	{Opt_inode64, "inode64"},
> >  	{Opt_err, NULL}
> >  };
> >  
> > @@ -1038,11 +1039,15 @@ xfs_fs_remount(
> >  {
> >  	struct xfs_mount	*mp = XFS_M(sb);
> >  	substring_t		args[MAX_OPT_ARGS];
> > +	xfs_sb_t		*sbp = &(mp->m_sb);
> > +	xfs_perag_t		*pag;
> >  	char			*p;
> >  	int			error;
> >  
> >  	while ((p = strsep(&options, ",")) != NULL) {
> >  		int token;
> > +		int agcount = sbp->sb_agcount;
> > +		int index = 0;
> >  
> >  		if (!*p)
> >  			continue;
> > @@ -1055,6 +1060,17 @@ xfs_fs_remount(
> >  		case Opt_nobarrier:
> >  			mp->m_flags &= ~XFS_MOUNT_BARRIER;
> >  			break;
> > +		case Opt_inode64:
> > +
> > +			for (index = 0; index < agcount; index++) {
> > +				pag = xfs_perag_get(mp, index);
> > +				pag->pagi_inodeok = 1;
> > +				xfs_perag_put(pag);
> > +			}
> > +			mp->m_flags &= ~XFS_MOUNT_32BITINODES;
> > +			mp->m_flags &= ~XFS_MOUNT_SMALL_INUMS;
> > +			mp->m_maxagi = index;
> > +			break;
> >  		default:
> >  			/*
> >  			 * Logically we would return an error here to prevent
> > 
> 

-- 
--Carlos

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] Make inode64 a remountable option
  2012-08-17  1:20   ` Carlos Maiolino
@ 2012-08-17  1:42     ` Dave Chinner
  0 siblings, 0 replies; 6+ messages in thread
From: Dave Chinner @ 2012-08-17  1:42 UTC (permalink / raw)
  To: xfs

On Thu, Aug 16, 2012 at 10:20:30PM -0300, Carlos Maiolino wrote:
> > Reviewed-by: Brian Foster <bfoster@redhat.com>
> > 
> > I do have a question though... do we care about the remount from inode64
> > to non-inode64 case?
> > 
> I thought about it, but, once we enable inode64 option, remounting it back to
> inode32 may create problems to access inodes greater than (1<<32) - 1, so, I
> don't think we should make inode32 a remountable option.

You can still read, modify and unlink inodes w/ numbers greater than
32 bits when inode32 is active - you just can't allocate new inodes
in those AGs. Hence going back the other way would still be safe to
do on remount, I think.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

end of thread, other threads:[~2012-08-17  1:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-16 18:35 [PATCH] Make inode64 a remountable option Carlos Maiolino
2012-08-16 20:23 ` Brian Foster
2012-08-17  1:20   ` Carlos Maiolino
2012-08-17  1:42     ` Dave Chinner
2012-08-16 22:40 ` Dave Chinner
2012-08-17  0:46   ` Carlos Maiolino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox