Re: [PATCH 7/7] ubifs: Add quota support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed 06-11-19 10:15:37, Sascha Hauer wrote:
> This introduces poor man's quota support for UBIFS. Unlike other
> implementations we never store anything on the flash. This has two
> big advantages:
> 
> - No possible regressions with a changed on-disk format
> - no quota files can get out of sync.
> 
> There are downsides as well:
> 
> - During mount the whole index must be scanned which takes some time
> - The quota limits must be set manually each time a filesystem is mounted.
> 
> UBIFS is targetted for embedded systems and quota limits are likely not
> changed interactively, so having to restore the quota limits with a
> script shouldn't be a big deal. The mount time penalty is a price we
> must pay, but for that we get a simple and straight forward
> implementation for this rather rarely used feature.
> 
> The quota data itself is stored in a red-black tree in memory. It is
> implemented as a quota format. When enabled with the "quota" mount
> option all three quota types (user, group, project) are enabled.
> 
> The quota integration into UBIFS is taken from a series posted earlier
> by Dongsheng Yang. Like the earlier series we only account regular files
> for quota. All others are counted in the number of files, but do not
> require any quota space.
> 
> Signed-off-by: Dongsheng Yang <yangds.fnst@xxxxxxxxxxxxxx>
> Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>

Two small comments from a quick look:

> +/**
> + * ubifs_dqblk_find_next - find the next qid
> + * @c: UBIFS file-system description object
> + * @qid: The qid to look for
> + *
> + * Find the next dqblk entry with a qid that is bigger or equally big than the
> + * given qid. Returns the next dqblk entry if found or NULL if no dqblk exists
> + * with a qid that is at least equally big.
> + */
> +static struct ubifs_dqblk *ubifs_dqblk_find_next(struct ubifs_info *c,
> +						 struct kqid qid)
> +{
> +	struct rb_node *node = c->dqblk_tree[qid.type].rb_node;
> +	struct ubifs_dqblk *next = NULL;
> +
> +	while (node) {
> +		struct ubifs_dqblk *ud = rb_entry(node, struct ubifs_dqblk, rb);
> +
> +		if (qid_eq(qid, ud->kqid))
> +			return ud;
> +
> +		if (qid_lt(qid, ud->kqid)) {
> +			if (!next || qid_lt(ud->kqid, next->kqid))
> +				next = ud;
> +
> +			node = node->rb_left;
> +		} else {
> +			node = node->rb_right;
> +		}
> +	}
> +
> +	return next;
> +}

Why not use rb_next() here? It should do what you need, shouldn't it?


> @@ -435,6 +438,9 @@ static int ubifs_show_options(struct seq_file *s, struct dentry *root)
>  	else if (c->mount_opts.chk_data_crc == 1)
>  		seq_puts(s, ",no_chk_data_crc");
>  
> +	if (c->quota_enable)
> +		seq_puts(s, ",quota");
> +

I'd expect here to see 'usrquota', 'grpquota', 'prjquota' etc. to match
mount options user has used.

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux