[PATCH 7/7] ubifs: Add quota support

Sascha Hauer s.hauer at pengutronix.de
Mon Nov 11 00:57:45 PST 2019


Hi Jan,

On Wed, Nov 06, 2019 at 11:14:28AM +0100, Jan Kara wrote:
> > +/**
> > + * 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?

I could use rb_next(), but it defeats the purpose of a tree to iterate
over the whole tree to find an entry. If I wanted that I would have used
a list.

> 
> 
> > @@ -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.

Ok, will fix in the next round.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the linux-mtd mailing list