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>
" -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"
" -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"
{"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"
ARG2ULL(dqb->dqb_bsoftlimit, optarg, 1024);
dqb->dqb_bsoftlimit >>= 10;
limit_mask |= BSLIMIT;
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;
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;
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;
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;
break;
default: /* getopt prints error message for us when opterr != 0 */
return CMD_HELP;