diff options
Diffstat (limited to 'fs/gfs2/quota.c')
| -rw-r--r-- | fs/gfs2/quota.c | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index c8b148bbdc8b..3aa17d4d1cfc 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
| @@ -145,7 +145,8 @@ static void gfs2_qd_dispose(struct list_head *list) | |||
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | 147 | ||
| 148 | static enum lru_status gfs2_qd_isolate(struct list_head *item, spinlock_t *lock, void *arg) | 148 | static enum lru_status gfs2_qd_isolate(struct list_head *item, |
| 149 | struct list_lru_one *lru, spinlock_t *lru_lock, void *arg) | ||
| 149 | { | 150 | { |
| 150 | struct list_head *dispose = arg; | 151 | struct list_head *dispose = arg; |
| 151 | struct gfs2_quota_data *qd = list_entry(item, struct gfs2_quota_data, qd_lru); | 152 | struct gfs2_quota_data *qd = list_entry(item, struct gfs2_quota_data, qd_lru); |
| @@ -155,7 +156,7 @@ static enum lru_status gfs2_qd_isolate(struct list_head *item, spinlock_t *lock, | |||
| 155 | 156 | ||
| 156 | if (qd->qd_lockref.count == 0) { | 157 | if (qd->qd_lockref.count == 0) { |
| 157 | lockref_mark_dead(&qd->qd_lockref); | 158 | lockref_mark_dead(&qd->qd_lockref); |
| 158 | list_move(&qd->qd_lru, dispose); | 159 | list_lru_isolate_move(lru, &qd->qd_lru, dispose); |
| 159 | } | 160 | } |
| 160 | 161 | ||
| 161 | spin_unlock(&qd->qd_lockref.lock); | 162 | spin_unlock(&qd->qd_lockref.lock); |
| @@ -171,8 +172,8 @@ static unsigned long gfs2_qd_shrink_scan(struct shrinker *shrink, | |||
| 171 | if (!(sc->gfp_mask & __GFP_FS)) | 172 | if (!(sc->gfp_mask & __GFP_FS)) |
| 172 | return SHRINK_STOP; | 173 | return SHRINK_STOP; |
| 173 | 174 | ||
| 174 | freed = list_lru_walk_node(&gfs2_qd_lru, sc->nid, gfs2_qd_isolate, | 175 | freed = list_lru_shrink_walk(&gfs2_qd_lru, sc, |
| 175 | &dispose, &sc->nr_to_scan); | 176 | gfs2_qd_isolate, &dispose); |
| 176 | 177 | ||
| 177 | gfs2_qd_dispose(&dispose); | 178 | gfs2_qd_dispose(&dispose); |
| 178 | 179 | ||
| @@ -182,7 +183,7 @@ static unsigned long gfs2_qd_shrink_scan(struct shrinker *shrink, | |||
| 182 | static unsigned long gfs2_qd_shrink_count(struct shrinker *shrink, | 183 | static unsigned long gfs2_qd_shrink_count(struct shrinker *shrink, |
| 183 | struct shrink_control *sc) | 184 | struct shrink_control *sc) |
| 184 | { | 185 | { |
| 185 | return vfs_pressure_ratio(list_lru_count_node(&gfs2_qd_lru, sc->nid)); | 186 | return vfs_pressure_ratio(list_lru_shrink_count(&gfs2_qd_lru, sc)); |
| 186 | } | 187 | } |
| 187 | 188 | ||
| 188 | struct shrinker gfs2_qd_shrinker = { | 189 | struct shrinker gfs2_qd_shrinker = { |
| @@ -667,7 +668,7 @@ static void do_qc(struct gfs2_quota_data *qd, s64 change) | |||
| 667 | 668 | ||
| 668 | static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, | 669 | static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, |
| 669 | s64 change, struct gfs2_quota_data *qd, | 670 | s64 change, struct gfs2_quota_data *qd, |
| 670 | struct fs_disk_quota *fdq) | 671 | struct qc_dqblk *fdq) |
| 671 | { | 672 | { |
| 672 | struct inode *inode = &ip->i_inode; | 673 | struct inode *inode = &ip->i_inode; |
| 673 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 674 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
| @@ -697,16 +698,16 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, | |||
| 697 | be64_add_cpu(&q.qu_value, change); | 698 | be64_add_cpu(&q.qu_value, change); |
| 698 | qd->qd_qb.qb_value = q.qu_value; | 699 | qd->qd_qb.qb_value = q.qu_value; |
| 699 | if (fdq) { | 700 | if (fdq) { |
| 700 | if (fdq->d_fieldmask & FS_DQ_BSOFT) { | 701 | if (fdq->d_fieldmask & QC_SPC_SOFT) { |
| 701 | q.qu_warn = cpu_to_be64(fdq->d_blk_softlimit >> sdp->sd_fsb2bb_shift); | 702 | q.qu_warn = cpu_to_be64(fdq->d_spc_softlimit >> sdp->sd_sb.sb_bsize_shift); |
| 702 | qd->qd_qb.qb_warn = q.qu_warn; | 703 | qd->qd_qb.qb_warn = q.qu_warn; |
| 703 | } | 704 | } |
| 704 | if (fdq->d_fieldmask & FS_DQ_BHARD) { | 705 | if (fdq->d_fieldmask & QC_SPC_HARD) { |
| 705 | q.qu_limit = cpu_to_be64(fdq->d_blk_hardlimit >> sdp->sd_fsb2bb_shift); | 706 | q.qu_limit = cpu_to_be64(fdq->d_spc_hardlimit >> sdp->sd_sb.sb_bsize_shift); |
| 706 | qd->qd_qb.qb_limit = q.qu_limit; | 707 | qd->qd_qb.qb_limit = q.qu_limit; |
| 707 | } | 708 | } |
| 708 | if (fdq->d_fieldmask & FS_DQ_BCOUNT) { | 709 | if (fdq->d_fieldmask & QC_SPACE) { |
| 709 | q.qu_value = cpu_to_be64(fdq->d_bcount >> sdp->sd_fsb2bb_shift); | 710 | q.qu_value = cpu_to_be64(fdq->d_space >> sdp->sd_sb.sb_bsize_shift); |
| 710 | qd->qd_qb.qb_value = q.qu_value; | 711 | qd->qd_qb.qb_value = q.qu_value; |
| 711 | } | 712 | } |
| 712 | } | 713 | } |
| @@ -1497,7 +1498,7 @@ static int gfs2_quota_get_xstate(struct super_block *sb, | |||
| 1497 | } | 1498 | } |
| 1498 | 1499 | ||
| 1499 | static int gfs2_get_dqblk(struct super_block *sb, struct kqid qid, | 1500 | static int gfs2_get_dqblk(struct super_block *sb, struct kqid qid, |
| 1500 | struct fs_disk_quota *fdq) | 1501 | struct qc_dqblk *fdq) |
| 1501 | { | 1502 | { |
| 1502 | struct gfs2_sbd *sdp = sb->s_fs_info; | 1503 | struct gfs2_sbd *sdp = sb->s_fs_info; |
| 1503 | struct gfs2_quota_lvb *qlvb; | 1504 | struct gfs2_quota_lvb *qlvb; |
| @@ -1505,7 +1506,7 @@ static int gfs2_get_dqblk(struct super_block *sb, struct kqid qid, | |||
| 1505 | struct gfs2_holder q_gh; | 1506 | struct gfs2_holder q_gh; |
| 1506 | int error; | 1507 | int error; |
| 1507 | 1508 | ||
| 1508 | memset(fdq, 0, sizeof(struct fs_disk_quota)); | 1509 | memset(fdq, 0, sizeof(*fdq)); |
| 1509 | 1510 | ||
| 1510 | if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF) | 1511 | if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF) |
| 1511 | return -ESRCH; /* Crazy XFS error code */ | 1512 | return -ESRCH; /* Crazy XFS error code */ |
| @@ -1522,12 +1523,9 @@ static int gfs2_get_dqblk(struct super_block *sb, struct kqid qid, | |||
| 1522 | goto out; | 1523 | goto out; |
| 1523 | 1524 | ||
| 1524 | qlvb = (struct gfs2_quota_lvb *)qd->qd_gl->gl_lksb.sb_lvbptr; | 1525 | qlvb = (struct gfs2_quota_lvb *)qd->qd_gl->gl_lksb.sb_lvbptr; |
| 1525 | fdq->d_version = FS_DQUOT_VERSION; | 1526 | fdq->d_spc_hardlimit = be64_to_cpu(qlvb->qb_limit) << sdp->sd_sb.sb_bsize_shift; |
| 1526 | fdq->d_flags = (qid.type == USRQUOTA) ? FS_USER_QUOTA : FS_GROUP_QUOTA; | 1527 | fdq->d_spc_softlimit = be64_to_cpu(qlvb->qb_warn) << sdp->sd_sb.sb_bsize_shift; |
| 1527 | fdq->d_id = from_kqid_munged(current_user_ns(), qid); | 1528 | fdq->d_space = be64_to_cpu(qlvb->qb_value) << sdp->sd_sb.sb_bsize_shift; |
| 1528 | fdq->d_blk_hardlimit = be64_to_cpu(qlvb->qb_limit) << sdp->sd_fsb2bb_shift; | ||
| 1529 | fdq->d_blk_softlimit = be64_to_cpu(qlvb->qb_warn) << sdp->sd_fsb2bb_shift; | ||
| 1530 | fdq->d_bcount = be64_to_cpu(qlvb->qb_value) << sdp->sd_fsb2bb_shift; | ||
| 1531 | 1529 | ||
| 1532 | gfs2_glock_dq_uninit(&q_gh); | 1530 | gfs2_glock_dq_uninit(&q_gh); |
| 1533 | out: | 1531 | out: |
| @@ -1536,10 +1534,10 @@ out: | |||
| 1536 | } | 1534 | } |
| 1537 | 1535 | ||
| 1538 | /* GFS2 only supports a subset of the XFS fields */ | 1536 | /* GFS2 only supports a subset of the XFS fields */ |
| 1539 | #define GFS2_FIELDMASK (FS_DQ_BSOFT|FS_DQ_BHARD|FS_DQ_BCOUNT) | 1537 | #define GFS2_FIELDMASK (QC_SPC_SOFT|QC_SPC_HARD|QC_SPACE) |
| 1540 | 1538 | ||
| 1541 | static int gfs2_set_dqblk(struct super_block *sb, struct kqid qid, | 1539 | static int gfs2_set_dqblk(struct super_block *sb, struct kqid qid, |
| 1542 | struct fs_disk_quota *fdq) | 1540 | struct qc_dqblk *fdq) |
| 1543 | { | 1541 | { |
| 1544 | struct gfs2_sbd *sdp = sb->s_fs_info; | 1542 | struct gfs2_sbd *sdp = sb->s_fs_info; |
| 1545 | struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode); | 1543 | struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode); |
| @@ -1583,17 +1581,17 @@ static int gfs2_set_dqblk(struct super_block *sb, struct kqid qid, | |||
| 1583 | goto out_i; | 1581 | goto out_i; |
| 1584 | 1582 | ||
| 1585 | /* If nothing has changed, this is a no-op */ | 1583 | /* If nothing has changed, this is a no-op */ |
| 1586 | if ((fdq->d_fieldmask & FS_DQ_BSOFT) && | 1584 | if ((fdq->d_fieldmask & QC_SPC_SOFT) && |
| 1587 | ((fdq->d_blk_softlimit >> sdp->sd_fsb2bb_shift) == be64_to_cpu(qd->qd_qb.qb_warn))) | 1585 | ((fdq->d_spc_softlimit >> sdp->sd_sb.sb_bsize_shift) == be64_to_cpu(qd->qd_qb.qb_warn))) |
| 1588 | fdq->d_fieldmask ^= FS_DQ_BSOFT; | 1586 | fdq->d_fieldmask ^= QC_SPC_SOFT; |
| 1589 | 1587 | ||
| 1590 | if ((fdq->d_fieldmask & FS_DQ_BHARD) && | 1588 | if ((fdq->d_fieldmask & QC_SPC_HARD) && |
| 1591 | ((fdq->d_blk_hardlimit >> sdp->sd_fsb2bb_shift) == be64_to_cpu(qd->qd_qb.qb_limit))) | 1589 | ((fdq->d_spc_hardlimit >> sdp->sd_sb.sb_bsize_shift) == be64_to_cpu(qd->qd_qb.qb_limit))) |
| 1592 | fdq->d_fieldmask ^= FS_DQ_BHARD; | 1590 | fdq->d_fieldmask ^= QC_SPC_HARD; |
| 1593 | 1591 | ||
| 1594 | if ((fdq->d_fieldmask & FS_DQ_BCOUNT) && | 1592 | if ((fdq->d_fieldmask & QC_SPACE) && |
| 1595 | ((fdq->d_bcount >> sdp->sd_fsb2bb_shift) == be64_to_cpu(qd->qd_qb.qb_value))) | 1593 | ((fdq->d_space >> sdp->sd_sb.sb_bsize_shift) == be64_to_cpu(qd->qd_qb.qb_value))) |
| 1596 | fdq->d_fieldmask ^= FS_DQ_BCOUNT; | 1594 | fdq->d_fieldmask ^= QC_SPACE; |
| 1597 | 1595 | ||
| 1598 | if (fdq->d_fieldmask == 0) | 1596 | if (fdq->d_fieldmask == 0) |
| 1599 | goto out_i; | 1597 | goto out_i; |
