[Dovecot] 1.0 roadmap - fs quota problem

Geo Carncross geocar-dovecot at internetconnection.net
Tue Jun 13 01:10:51 EEST 2006


On Mon, 2006-06-12 at 21:56 +0300, Timo Sirainen wrote:
> On Jun 12, 2006, at 9:48 PM, Dumitru Negara wrote:
> 
> >> So I looked through repquota's sources and it looks like XFS has  
> >> its own
> >> Q_XGETQSTAT quota command which needs to be used with it. I think I'm
> >> not going to bother figuring out how it's supposed to be used.  
> >> Patches
> >> welcome.
> >>
> > OK, let's do it again :) ... with ext3 partition.
> ..
> 
> Well, I think my answer is still the same. Someone who actually knows  
> how the filesystem quota stuff is supposed to work could fix it. I  
> don't see it important enough to waste spending time on.

It's the switch to quota v2 that's messing this up- all the dqb_* struct
elements moved from uint32 to uint64. To make it possible to compile
things on both old and new Linux systems, I use the defines manually:

#ifndef _LINUX_QUOTA_VERSION
	struct fake_dq_struct {
u_int64_t dqb_bhardlimit;   /* absolute limit on disk quota blocks alloc
*/
u_int64_t dqb_bsoftlimit;   /* preferred limit on disk quota blocks */
u_int64_t dqb_curspace;     /* current quota block count */
u_int64_t dqb_ihardlimit;   /* maximum # allocated inodes */
u_int64_t dqb_isoftlimit;   /* preferred inode limit */
u_int64_t dqb_curinodes;    /* current # allocated inodes */
u_int64_t dqb_btime;        /* time limit for excessive disk use */
u_int64_t dqb_itime;        /* time limit for excessive files */
u_int32_t dqb_valid;        /* bitmask of QIF_* constants */
};

	struct fake_dq_struct fake_dq;
#endif
	struct dqblk dq;


Then I get the quotas using:

#ifndef _LINUX_QUOTA_VERSION
	r = quotactl(0x80000700, q_special, uid, (caddr_t)&fake_dq);
	if (r != -1) {
		/* use fake_dq... */
		return;
	}
#endif
	r = quotactl(QCMD(Q_GETQUOTA,USRQUOTA),
		q_special,uid,(caddr_t)&dq);
	if (r != -1) {
		/* use dq ... */
		return;
	}

	/* failure */

(where q_special is the block special path)

I don't have any XFS volumes, so hopefully someone who does can sew this
together with XFS's method and resolve the mess that is quota on UNIX.	


As an alternate: what about using get_quota_command= or something that
would print out the correct quota using the system's own quota command?

-- 
Internet Connection High Quality Web Hosting
http://www.internetconnection.net/



More information about the dovecot mailing list