Whamcloud - gitweb
LU-3220 quota: warning on setting small limits 82/6182/4
authorNiu Yawei <yawei.niu@intel.com>
Sat, 27 Apr 2013 05:07:32 +0000 (01:07 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 10 Jul 2013 02:20:55 +0000 (02:20 +0000)
When user try to set quota limits smaller than the minimal qunit
size (1M bytes for block limit, 1K inodes for inode limit), we'd
warn user that limit is too small.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: I26e2e682500628211e2f2bedf65e534f3b214422
Reviewed-on: http://review.whamcloud.com/6182
Tested-by: Hudson
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
lustre/utils/lfs.c

index f258453..556f837 100644 (file)
@@ -235,7 +235,14 @@ command_t cmdlist[] = {
          "       -b can be used instead of --block-softlimit/--block-grace\n"
          "       -B can be used instead of --block-hardlimit\n"
          "       -i can be used instead of --inode-softlimit/--inode-grace\n"
-         "       -I can be used instead of --inode-hardlimit"},
+        "       -I can be used instead of --inode-hardlimit\n\n"
+        "Note: The total quota space will be split into many qunits and\n"
+        "      balanced over all server targets, the minimal qunit size is\n"
+        "      1M bytes for block space and 1K inodes for inode space.\n\n"
+        "      Quota space rebalancing process will stop when this mininum\n"
+        "      value is reached. As a result, quota exceeded can be returned\n"
+        "      while many targets still have 1MB or 1K inodes of spare\n"
+        "      quota space."},
         {"quota", lfs_quota, 0, "Display disk usage and limits.\n"
          "usage: quota [-q] [-v] [-o <obd_uuid>|-i <mdt_idx>|-I <ost_idx>]\n"
          "             [<-u|-g> <uname>|<uid>|<gname>|<gid>] <filesystem>\n"
@@ -2296,19 +2303,43 @@ int lfs_setquota(int argc, char **argv)
                         ARG2ULL(dqb->dqb_bsoftlimit, optarg, 1024);
                         dqb->dqb_bsoftlimit >>= 10;
                         limit_mask |= BSLIMIT;
+                       if (dqb->dqb_bsoftlimit &&
+                           dqb->dqb_bsoftlimit <= 1024) /* <= 1M? */
+                               fprintf(stderr, "warning: block softlimit is "
+                                       "smaller than the miminal qunit size, "
+                                       "please see the help of setquota or "
+                                       "Lustre manual for details.\n");
                         break;
                 case 'B':
                         ARG2ULL(dqb->dqb_bhardlimit, optarg, 1024);
                         dqb->dqb_bhardlimit >>= 10;
                         limit_mask |= BHLIMIT;
+                       if (dqb->dqb_bhardlimit &&
+                           dqb->dqb_bhardlimit <= 1024) /* <= 1M? */
+                               fprintf(stderr, "warning: block hardlimit is "
+                                       "smaller than the miminal qunit size, "
+                                       "please see the help of setquota or "
+                                       "Lustre manual for details.\n");
                         break;
                 case 'i':
                         ARG2ULL(dqb->dqb_isoftlimit, optarg, 1);
                         limit_mask |= ISLIMIT;
+                       if (dqb->dqb_isoftlimit &&
+                           dqb->dqb_isoftlimit <= 1024) /* <= 1K inodes? */
+                               fprintf(stderr, "warning: inode softlimit is "
+                                       "smaller than the miminal qunit size, "
+                                       "please see the help of setquota or "
+                                       "Lustre manual for details.\n");
                         break;
                 case 'I':
                         ARG2ULL(dqb->dqb_ihardlimit, optarg, 1);
                         limit_mask |= IHLIMIT;
+                       if (dqb->dqb_ihardlimit &&
+                           dqb->dqb_ihardlimit <= 1024) /* <= 1K inodes? */
+                               fprintf(stderr, "warning: inode hardlimit is "
+                                       "smaller than the miminal qunit size, "
+                                       "please see the help of setquota or "
+                                       "Lustre manual for details.\n");
                         break;
                 default: /* getopt prints error message for us when opterr != 0 */
                         return CMD_HELP;