DBG(1, "Checking Quota file ([%3d] ino [0x%x])\n", qtype, ino);
needs_writeout = 0;
- ret = quota_compare_and_update(sbi, qtype, &needs_writeout);
+ ret = quota_compare_and_update(sbi, qtype, &needs_writeout,
+ c.preserve_limits);
if (ret == 0 && needs_writeout == 0) {
DBG(1, "OK\n");
continue;
MSG(0, " -f check/fix entire partition\n");
MSG(0, " -p preen mode [default:0 the same as -a [0|1]]\n");
MSG(0, " -t show directory tree\n");
+ MSG(0, " -q preserve quota limits\n");
MSG(0, " --dry-run do not really fix corruptions\n");
exit(1);
}
}
if (!strcmp("fsck.f2fs", prog)) {
- const char *option_string = ":ad:fp:t";
+ const char *option_string = ":ad:fp:q:t";
int opt = 0;
struct option long_opt[] = {
{"dry-run", no_argument, 0, 1},
c.fix_on = 1;
MSG(0, "Info: Force to fix corruption\n");
break;
+ case 'q':
+ c.preserve_limits = atoi(optarg);
+ MSG(0, "Info: Preserve quota limits = %d\n",
+ c.preserve_limits);
+ break;
case 't':
c.show_dentry = 1;
break;
-
-
case ':':
if (optopt == 'p') {
MSG(0, "Info: Use default preen mode\n");
* set to 1 if the supplied and on-disk quota usage values are not identical.
*/
errcode_t quota_compare_and_update(struct f2fs_sb_info *sbi,
- enum quota_type qtype, int *usage_inconsistent)
+ enum quota_type qtype, int *usage_inconsistent,
+ int preserve_limits)
{
struct f2fs_fsck *fsck = F2FS_FSCK(sbi);
quota_ctx_t qctx = fsck->qctx;
}
scan_data.quota_dict = qctx->quota_dict[qtype];
- scan_data.update_limits = 1;
+ scan_data.update_limits = preserve_limits;
scan_data.update_usage = 0;
scan_data.usage_is_inconsistent = 0;
err = qh.qh_ops->scan_dquots(&qh, scan_dquots_callback, &scan_data);
struct f2fs_inode* inode);
void quota_release_context(quota_ctx_t *qctx);
errcode_t quota_compare_and_update(struct f2fs_sb_info *sbi,
- enum quota_type qtype, int *usage_inconsistent);
+ enum quota_type qtype, int *usage_inconsistent,
+ int preserve_limits);
static inline errcode_t quota_get_mem(unsigned long size, void *ptr)
{
int auto_fix;
int preen_mode;
int ro;
+ int preserve_limits; /* preserve quota limits */
__le32 feature; /* defined features */
/* defragmentation parameters */
c.zoned_mode = 0;
c.zoned_model = 0;
c.zone_blocks = 0;
+#ifdef WITH_ANDROID
+ c.preserve_limits = 0;
+#else
+ c.preserve_limits = 1;
+#endif
for (i = 0; i < MAX_DEVICES; i++) {
memset(&c.devices[i], 0, sizeof(struct device_info));