[Top] [All Lists]

Re: separate project quota from group quota (questions, design issues)

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: separate project quota from group quota (questions, design issues)
From: Arkadiusz Miskiewicz <arekm@xxxxxxxx>
Date: Sun, 5 Sep 2010 19:24:35 +0200
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20100904233053.GA26586@xxxxxxxxxxxxx>
References: <201009041000.55878.arekm@xxxxxxxx> <20100904233053.GA26586@xxxxxxxxxxxxx>
User-agent: KMail/1.13.5 (Linux/2.6.35-final-dirty; KDE/4.5.1; x86_64; ; )
On Sunday 05 of September 2010, Christoph Hellwig wrote:
> Thanks for doing this work Arek, I think it will be useful for some
> users and defintively is cleaners than what we have now.
> > I started doing that by splitting every group+project handling code into
> > separate group and project one. Added superblock field for project quota.
> > New feature flag (SEPARATEPQUOTA).
> Ok.
> > If old filesystem (for SEPARATEQUOTA) is mounted then I'll simply load
> > sb_gquotino into mp->m_sb.sb_pquotino which I think is enough to handle
> > old fs (since new kernel operates on separate structures for project
> > quota).
> Do you mean an old filesystem without the SEPARATEQUOTA bit set here?

Yes. When trying to load existing project quota inode in 
xfs_qm_init_quotainos() I'm doing:

+                       if (!xfs_sb_version_hasseparatepquota(&mp->m_sb)) {
+                               ASSERT(!XFS_IS_GQUOTA_ON(mp));
+                               mp->m_sb.sb_pquotino = mp->m_sb.sb_gquotino;
+                               mp->m_sb.sb_gquotino = 0;
+                       }

While xfs_mod_sb() now does:

         * Filesystem has no separatepquota turned on,                          
         * so we need to store project quota in group                           
         * quota inode on disk.                                                 
        if (!xfs_sb_version_hasseparatepquota(&mp->m_sb)) {                     
                mp->m_sb.sb_gquotino = mp->m_sb.sb_pquotino;                    
                mp->m_sb.sb_pquotino = 0;                                       

       xfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb, fields);

         * Restore original in-memory project quota inode state.
        if (!xfs_sb_version_hasseparatepquota(&mp->m_sb)) {                     
                mp->m_sb.sb_pquotino = mp->m_sb.sb_gquotino;                    
                mp->m_sb.sb_gquotino = 0;                                       

so in-memory sb_pquotaino is always used for project quota (regardless of 
SEPARATEPQUOTA feature) while on-disk is depending on SEPARATEPQUOTA feature 
bit. SB modify part is untested yet.

> > Converting old fs to separate quota isn't currently solved. User could
> > need two choices - use old group quota still as group or old group as
> > new project quota. Not sure how to handle these yet.
> We know what sb_gquotino is used for currently from sb_qflags.  If it's
> used for group quota we can simply set the SEPARATEQUOTA bit and we're
> done.  To convert a filesystem using project quotas to SEPARATEQUOTA
> sb_gquotino needs to be cleared and instead the new sb_pquotino field
> needs to point to the project quota inode.

Ok, I'll add new "upgrade <feature>" command to xfs_db (and call it from 
xfs_admin, too) where for now the only feature will be "separatepquota" one.

Arkadiusz Miśkiewicz        PLD/Linux Team
arekm / maven.pl            http://ftp.pld-linux.org/

<Prev in Thread] Current Thread [Next in Thread>