quota: unify ->set_dqblk
Pass the larger struct fs_disk_quota to the ->set_dqblk operation so that the Q_SETQUOTA and Q_XSETQUOTA operations can be implemented with a single filesystem operation and we can retire the ->set_xquota operation. The additional information (RT-subvolume accounting and warn counts) are left zero for the VFS quota implementation. Add new fieldmask values for setting the numer of blocks and inodes values which is required for the VFS quota, but wasn't for XFS. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
Esse commit está contido em:
@@ -167,18 +167,44 @@ static int quota_getquota(struct super_block *sb, int type, qid_t id,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void copy_from_if_dqblk(struct fs_disk_quota *dst, struct if_dqblk *src)
|
||||
{
|
||||
dst->d_blk_hardlimit = src->dqb_bhardlimit;
|
||||
dst->d_blk_softlimit = src->dqb_bsoftlimit;
|
||||
dst->d_bcount = src->dqb_curspace;
|
||||
dst->d_ino_hardlimit = src->dqb_ihardlimit;
|
||||
dst->d_ino_softlimit = src->dqb_isoftlimit;
|
||||
dst->d_icount = src->dqb_curinodes;
|
||||
dst->d_btimer = src->dqb_btime;
|
||||
dst->d_itimer = src->dqb_itime;
|
||||
|
||||
dst->d_fieldmask = 0;
|
||||
if (src->dqb_valid & QIF_BLIMITS)
|
||||
dst->d_fieldmask |= FS_DQ_BSOFT | FS_DQ_BHARD;
|
||||
if (src->dqb_valid & QIF_SPACE)
|
||||
dst->d_fieldmask |= FS_DQ_BCOUNT;
|
||||
if (src->dqb_valid & QIF_ILIMITS)
|
||||
dst->d_fieldmask |= FS_DQ_ISOFT | FS_DQ_IHARD;
|
||||
if (src->dqb_valid & QIF_INODES)
|
||||
dst->d_fieldmask |= FS_DQ_ICOUNT;
|
||||
if (src->dqb_valid & QIF_BTIME)
|
||||
dst->d_fieldmask |= FS_DQ_BTIMER;
|
||||
if (src->dqb_valid & QIF_ITIME)
|
||||
dst->d_fieldmask |= FS_DQ_ITIMER;
|
||||
}
|
||||
|
||||
static int quota_setquota(struct super_block *sb, int type, qid_t id,
|
||||
void __user *addr)
|
||||
{
|
||||
struct fs_disk_quota fdq;
|
||||
struct if_dqblk idq;
|
||||
|
||||
if (copy_from_user(&idq, addr, sizeof(idq)))
|
||||
return -EFAULT;
|
||||
if (!sb_has_quota_active(sb, type))
|
||||
return -ESRCH;
|
||||
if (!sb->s_qcop->set_dqblk)
|
||||
return -ENOSYS;
|
||||
return sb->s_qcop->set_dqblk(sb, type, id, &idq);
|
||||
copy_from_if_dqblk(&fdq, &idq);
|
||||
return sb->s_qcop->set_dqblk(sb, type, id, &fdq);
|
||||
}
|
||||
|
||||
static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr)
|
||||
@@ -212,9 +238,9 @@ static int quota_setxquota(struct super_block *sb, int type, qid_t id,
|
||||
|
||||
if (copy_from_user(&fdq, addr, sizeof(fdq)))
|
||||
return -EFAULT;
|
||||
if (!sb->s_qcop->set_xquota)
|
||||
if (!sb->s_qcop->set_dqblk)
|
||||
return -ENOSYS;
|
||||
return sb->s_qcop->set_xquota(sb, type, id, &fdq);
|
||||
return sb->s_qcop->set_dqblk(sb, type, id, &fdq);
|
||||
}
|
||||
|
||||
static int quota_getxquota(struct super_block *sb, int type, qid_t id,
|
||||
|
Referência em uma nova issue
Block a user