• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/src/linux/linux-2.6/fs/

Lines Matching refs:dquot

266 /* Find space for dquot */
267 static uint find_free_dqentry(struct dquot *dquot, int *err)
269 struct super_block *sb = dquot->dq_sb;
270 struct mem_dqinfo *info = sb_dqopt(sb)->info+dquot->dq_type;
286 if ((*err = read_blk(sb, dquot->dq_type, blk, buf)) < 0)
290 blk = get_free_dqblk(sb, dquot->dq_type);
299 mark_info_dirty(sb, dquot->dq_type);
302 if ((*err = remove_free_dqentry(sb, dquot->dq_type, buf, blk)) < 0) {
317 if ((*err = write_blk(sb, dquot->dq_type, blk, buf)) < 0) {
321 dquot->dq_off = (blk<<V2_DQBLKSIZE_BITS)+sizeof(struct v2_disk_dqdbheader)+i*sizeof(struct v2_disk_dqblk);
330 static int do_insert_tree(struct dquot *dquot, uint *treeblk, int depth)
332 struct super_block *sb = dquot->dq_sb;
341 ret = get_free_dqblk(sb, dquot->dq_type);
349 if ((ret = read_blk(sb, dquot->dq_type, *treeblk, buf)) < 0) {
355 newblk = le32_to_cpu(ref[GETIDINDEX(dquot->dq_id, depth)]);
361 printk(KERN_ERR "VFS: Inserting already present quota entry (block %u).\n", le32_to_cpu(ref[GETIDINDEX(dquot->dq_id, depth)]));
366 newblk = find_free_dqentry(dquot, &ret);
369 ret = do_insert_tree(dquot, &newblk, depth+1);
371 ref[GETIDINDEX(dquot->dq_id, depth)] = cpu_to_le32(newblk);
372 ret = write_blk(sb, dquot->dq_type, *treeblk, buf);
375 put_free_dqblk(sb, dquot->dq_type, buf, *treeblk);
382 static inline int dq_insert_tree(struct dquot *dquot)
385 return do_insert_tree(dquot, &tmp, 0);
391 static int v2_write_dquot(struct dquot *dquot)
393 int type = dquot->dq_type;
398 if (!dquot->dq_off)
399 if ((ret = dq_insert_tree(dquot)) < 0) {
404 mem2diskdqb(&ddquot, &dquot->dq_dqb, dquot->dq_id);
412 ret = dquot->dq_sb->s_op->quota_write(dquot->dq_sb, type,
413 (char *)&ddquot, sizeof(struct v2_disk_dqblk), dquot->dq_off);
415 printk(KERN_WARNING "VFS: dquota write failed on dev %s\n", dquot->dq_sb->s_id);
426 /* Free dquot entry in data block */
427 static int free_dqentry(struct dquot *dquot, uint blk)
429 struct super_block *sb = dquot->dq_sb;
430 int type = dquot->dq_type;
437 if (dquot->dq_off >> V2_DQBLKSIZE_BITS != blk) {
440 (uint)(dquot->dq_off >> V2_DQBLKSIZE_BITS));
458 memset(buf+(dquot->dq_off & ((1 << V2_DQBLKSIZE_BITS)-1)), 0,
474 dquot->dq_off = 0; /* Quota is now unattached */
480 /* Remove reference to dquot from tree */
481 static int remove_tree(struct dquot *dquot, uint *blk, int depth)
483 struct super_block *sb = dquot->dq_sb;
484 int type = dquot->dq_type;
496 newblk = le32_to_cpu(ref[GETIDINDEX(dquot->dq_id, depth)]);
498 ret = free_dqentry(dquot, newblk);
502 ret = remove_tree(dquot, &newblk, depth+1);
505 ref[GETIDINDEX(dquot->dq_id, depth)] = cpu_to_le32(0);
522 /* Delete dquot from tree */
523 static int v2_delete_dquot(struct dquot *dquot)
527 if (!dquot->dq_off) /* Even not allocated? */
529 return remove_tree(dquot, &tmp, 0);
533 static loff_t find_block_dqentry(struct dquot *dquot, uint blk)
542 if ((ret = read_blk(dquot->dq_sb, dquot->dq_type, blk, buf)) < 0) {
546 if (dquot->dq_id)
548 le32_to_cpu(ddquot[i].dqb_id) != dquot->dq_id; i++);
560 "but not present.\n", dquot->dq_id);
573 static loff_t find_tree_dqentry(struct dquot *dquot, uint blk, int depth)
581 if ((ret = read_blk(dquot->dq_sb, dquot->dq_type, blk, buf)) < 0) {
586 blk = le32_to_cpu(ref[GETIDINDEX(dquot->dq_id, depth)]);
590 ret = find_tree_dqentry(dquot, blk, depth+1);
592 ret = find_block_dqentry(dquot, blk);
599 static inline loff_t find_dqentry(struct dquot *dquot)
601 return find_tree_dqentry(dquot, V2_DQTREEOFF, 0);
604 static int v2_read_dquot(struct dquot *dquot)
606 int type = dquot->dq_type;
613 if (!dquot->dq_sb || !sb_dqopt(dquot->dq_sb)->files[type]) {
618 offset = find_dqentry(dquot);
622 "structure for id %u.\n", dquot->dq_id);
623 dquot->dq_off = 0;
624 set_bit(DQ_FAKE_B, &dquot->dq_flags);
625 memset(&dquot->dq_dqb, 0, sizeof(struct mem_dqblk));
629 dquot->dq_off = offset;
630 if ((ret = dquot->dq_sb->s_op->quota_read(dquot->dq_sb, type,
636 "structure for id %u.\n", dquot->dq_id);
647 disk2memdqb(&dquot->dq_dqb, &ddquot);
648 if (!dquot->dq_dqb.dqb_bhardlimit &&
649 !dquot->dq_dqb.dqb_bsoftlimit &&
650 !dquot->dq_dqb.dqb_ihardlimit &&
651 !dquot->dq_dqb.dqb_isoftlimit)
652 set_bit(DQ_FAKE_B, &dquot->dq_flags);
659 /* Check whether dquot should not be deleted. We know we are
660 * the only one operating on dquot (thanks to dq_lock) */
661 static int v2_release_dquot(struct dquot *dquot)
663 if (test_bit(DQ_FAKE_B, &dquot->dq_flags) && !(dquot->dq_dqb.dqb_curinodes | dquot->dq_dqb.dqb_curspace))
664 return v2_delete_dquot(dquot);