Re: [PATCH 13/14] xfs: enable bigtime for quota timers

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

 



On Wed, Jan 1, 2020 at 3:12 AM Darrick J. Wong <darrick.wong@xxxxxxxxxx> wrote:
>
> From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
>
> Enable the bigtime feature for quota timers.  We decrease the accuracy
> of the timers to ~4s in exchange for being able to set timers up to the
> bigtime maximum.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> ---
>  fs/xfs/libxfs/xfs_dquot_buf.c  |   72 ++++++++++++++++++++++++++++++++++++++--
>  fs/xfs/libxfs/xfs_format.h     |   22 ++++++++++++
>  fs/xfs/libxfs/xfs_quota_defs.h |   11 ++++--
>  fs/xfs/scrub/quota.c           |    5 +++
>  fs/xfs/xfs_dquot.c             |   71 +++++++++++++++++++++++++++++++--------
>  fs/xfs/xfs_ondisk.h            |    6 +++
>  fs/xfs/xfs_qm.c                |   13 ++++---
>  fs/xfs/xfs_qm.h                |    8 ++--
>  fs/xfs/xfs_qm_syscalls.c       |   19 ++++++-----
>  9 files changed, 186 insertions(+), 41 deletions(-)
>
>
> diff --git a/fs/xfs/libxfs/xfs_dquot_buf.c b/fs/xfs/libxfs/xfs_dquot_buf.c
> index 72e0fcfef580..2b5d51a6d64b 100644
> --- a/fs/xfs/libxfs/xfs_dquot_buf.c
> +++ b/fs/xfs/libxfs/xfs_dquot_buf.c
> @@ -40,6 +40,8 @@ xfs_dquot_verify(
>         xfs_dqid_t              id,
>         uint                    type)   /* used only during quotacheck */
>  {
> +       uint8_t                 dtype;
> +
>         /*
>          * We can encounter an uninitialized dquot buffer for 2 reasons:
>          * 1. If we crash while deleting the quotainode(s), and those blks got
> @@ -60,11 +62,22 @@ xfs_dquot_verify(
>         if (ddq->d_version != XFS_DQUOT_VERSION)
>                 return __this_address;
>
> -       if (type && ddq->d_flags != type)
> +       dtype = ddq->d_flags & XFS_DQ_ALLTYPES;

Suggest dtype = XFS_DQ_TYPE(ddq->d_flags);

[...]

> @@ -540,13 +551,28 @@ xfs_dquot_from_disk(
>         dqp->q_res_icount = be64_to_cpu(ddqp->d_icount);
>         dqp->q_res_rtbcount = be64_to_cpu(ddqp->d_rtbcount);
>
> -       xfs_dquot_from_disk_timestamp(&tv, ddqp->d_btimer);
> +       xfs_dquot_from_disk_timestamp(ddqp, &tv, ddqp->d_btimer);
>         dqp->q_btimer = tv.tv_sec;
> -       xfs_dquot_from_disk_timestamp(&tv, ddqp->d_itimer);
> +       xfs_dquot_from_disk_timestamp(ddqp, &tv, ddqp->d_itimer);
>         dqp->q_itimer = tv.tv_sec;
> -       xfs_dquot_from_disk_timestamp(&tv, ddqp->d_rtbtimer);
> +       xfs_dquot_from_disk_timestamp(ddqp, &tv, ddqp->d_rtbtimer);
>         dqp->q_rtbtimer = tv.tv_sec;
>
> +       /* Upgrade to bigtime if possible. */
> +       if (xfs_dquot_add_bigtime(dqp->q_mount, iddq)) {
> +               tv.tv_sec = xfs_dquot_clamp_timer(iddq, dqp->q_btimer);
> +               xfs_dquot_to_disk_timestamp(iddq, &iddq->d_btimer, &tv);
> +               dqp->q_btimer = tv.tv_sec;
> +
> +               tv.tv_sec = xfs_dquot_clamp_timer(iddq, dqp->q_itimer);
> +               xfs_dquot_to_disk_timestamp(iddq, &iddq->d_itimer, &tv);
> +               dqp->q_itimer = tv.tv_sec;
> +
> +               tv.tv_sec = xfs_dquot_clamp_timer(iddq, dqp->q_rtbtimer);
> +               xfs_dquot_to_disk_timestamp(iddq, &iddq->d_rtbtimer, &tv);
> +               dqp->q_rtbtimer = tv.tv_sec;
> +       }
> +

This is better than the inode timestamp conversion because at
least the bigtime flag incore is always consistent with the incore values.
But I think it would be safer if the conversion happened inside the helper.

Thanks,
Amir.



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux