dovecot-2.2: quota: Support for fs hard limit

dovecot at dovecot.org dovecot at dovecot.org
Tue Jul 17 16:04:06 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/cdba6fec5ddf
changeset: 14714:cdba6fec5ddf
user:      Jan Friesse <jfriesse at gmail.com>
date:      Tue Jul 17 16:03:43 2012 +0300
description:
quota: Support for fs hard limit
Support for hard limit is implemented for NFS, but sadly not for other
filesystems. If softlimit is not set (it's 0), hardlimit should be used.
---
 src/plugins/quota/quota-fs.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diffstat:

 src/plugins/quota/quota-fs.c |  31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diffs (84 lines):

diff -r 76fe255ba921 -r cdba6fec5ddf src/plugins/quota/quota-fs.c
--- a/src/plugins/quota/quota-fs.c	Mon Jul 16 20:41:51 2012 +0300
+++ b/src/plugins/quota/quota-fs.c	Tue Jul 17 16:03:43 2012 +0300
@@ -566,9 +566,15 @@
 			/* values always returned in 512 byte blocks */
 			*value_r = xdqblk.d_bcount * 512;
 			*limit_r = xdqblk.d_blk_softlimit * 512;
+			if (*limit_r == 0) {
+				*limit_r = xdqblk.d_blk_hardlimit * 512;
+			}
 		} else {
 			*value_r = xdqblk.d_icount;
 			*limit_r = xdqblk.d_ino_softlimit;
+			if (*limit_r == 0) {
+				*limit_r = xdqblk.d_ino_hardlimit;
+			}
 		}
 	} else
 #endif
@@ -600,9 +606,15 @@
 			*value_r = dqblk.dqb_curblocks;
 #endif
 			*limit_r = dqblk.dqb_bsoftlimit * 1024;
+			if (*limit_r == 0) {
+				*limit_r = dqblk.dqb_bhardlimit * 1024;
+			}
 		} else {
 			*value_r = dqblk.dqb_curinodes;
 			*limit_r = dqblk.dqb_isoftlimit;
+			if (*limit_r == 0) {
+				*limit_r = dqblk.dqb_ihardlimit;
+			}
 		}
 	}
 	return 1;
@@ -633,9 +645,15 @@
 	if (bytes) {
 		*value_r = (uint64_t)dqblk.dqb_curblocks * DEV_BSIZE;
 		*limit_r = (uint64_t)dqblk.dqb_bsoftlimit * DEV_BSIZE;
+		if (*limit_r == 0) {
+			*limit_r = (uint64_t)dqblk.dqb_bhardlimit * DEV_BSIZE;
+		}
 	} else {
 		*value_r = dqblk.dqb_curinodes;
 		*limit_r = dqblk.dqb_isoftlimit;
+		if (*limit_r == 0) {
+			*limit_r = dqblk.dqb_ihardlimit;
+		}
 	}
 	return 1;
 }
@@ -664,9 +682,16 @@
 			root->mount->block_size;
 		*limit_r = (uint64_t)dqblk.dqb_bsoftlimit *
 			root->mount->block_size;
+		if (*limit_r == 0) {
+			*limit_r = (uint64_t)dqblk.dqb_bhardlimit *
+				root->mount->block_size;
+		}
 	} else {
 		*value_r = dqblk.dqb_curfiles;
 		*limit_r = dqblk.dqb_fsoftlimit;
+		if (*limit_r == 0) {
+			*limit_r = dqblk.dqb_fhardlimit;
+		}
 	}
 	return 1;
 }
@@ -693,9 +718,15 @@
 	if (bytes) {
 		*value_r = (uint64_t)dqblk.dqb_curblocks * DEV_BSIZE;
 		*limit_r = (uint64_t)dqblk.dqb_bsoftlimit * DEV_BSIZE;
+		if (*limit_r == 0) {
+			*limit_r = (uint64_t)dqblk.dqb_bhardlimit * DEV_BSIZE;
+		}
 	} else {
 		*value_r = dqblk.dqb_curfiles;
 		*limit_r = dqblk.dqb_fsoftlimit;
+		if (*limit_r == 0) {
+			*limit_r = dqblk.dqb_fhardlimit;
+		}
 	}
 	return 1;
 }


More information about the dovecot-cvs mailing list