remove several typedefs in quota code
v3 cover remove several typedefs in quota code
Eliminate some typedefs.
Pavel Reichl (4):
xfs: remove the xfs_disk_dquot_t and xfs_dquot_t
xfs: remove the xfs_quotainfo_t typedef
xfs: remove the xfs_dq_logitem_t typedef
xfs: remove the xfs_qoff_logitem_t typedef
fs/xfs/libxfs/xfs_dquot_buf.c | 8 +-- fs/xfs/libxfs/xfs_format.h | 10 +-- fs/xfs/libxfs/xfs_trans_resv.c | 5 +- fs/xfs/xfs_dquot.c | 20 +++--- fs/xfs/xfs_dquot.h | 111 +++++++++++++++++++-------------- fs/xfs/xfs_dquot_item.h | 34 +++++----- fs/xfs/xfs_log_recover.c | 5 +- fs/xfs/xfs_qm.c | 50 +++++++-------- fs/xfs/xfs_qm.h | 6 +- fs/xfs/xfs_qm_bhv.c | 6 +- fs/xfs/xfs_qm_syscalls.c | 29 +++++---- fs/xfs/xfs_trans_dquot.c | 56 ++++++++--------- 12 files changed, 181 insertions(+), 159 deletions(-)
Signature · 1 line
2.23.0
PATCH v3 1/4 xfs: remove the xfs_disk_dquot_t and xfs_dquot_t
--- fs/xfs/libxfs/xfs_dquot_buf.c | 8 +-- fs/xfs/libxfs/xfs_format.h | 10 +-- fs/xfs/libxfs/xfs_trans_resv.c | 1 - fs/xfs/xfs_dquot.c | 18 +++--- fs/xfs/xfs_dquot.h | 111 +++++++++++++++++++-------------- fs/xfs/xfs_log_recover.c | 5 +- fs/xfs/xfs_qm.c | 30 ++++----- fs/xfs/xfs_qm_bhv.c | 6 +- fs/xfs/xfs_trans_dquot.c | 42 ++++++------- 9 files changed, 124 insertions(+), 107 deletions(-)
fs/xfs/libxfs/xfs_dquot_buf.c +4 -4
@@ -35,10 +35,10 @@ xfs_calc_dquots_per_chunk(xfs_failaddr_t xfs_dquot_verify ( -struct xfs_mount *mp, -xfs_disk_dquot_t *ddq, -xfs_dqid_t id, -uint type)/* used only during quotacheck */ +struct xfs_mount *mp, +struct xfs_disk_dquot *ddq, +xfs_dqid_t id, +uint type)/* used only during quotacheck */ {/* * We can encounter an uninitialized dquot buffer for 2 reasons:
fs/xfs/libxfs/xfs_format.h +5 -5
@@ -1144,11 +1144,11 @@ static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev)/* * This is the main portion of the on-disk representation of quota -* information for a user. This is the q_core of the xfs_dquot_t that +* information for a user. This is the q_core of the struct xfs_dquot that * is kept in kernel memory. We pad this with some more expansion room * to construct the on disk structure. */ -typedef struct xfs_disk_dquot { +struct xfs_disk_dquot {__be16 d_magic;/* dquot magic = XFS_DQUOT_MAGIC */ __u8 d_version;/* dquot version */ __u8 d_flags;/* XFS_DQ_USER/PROJ/GROUP */
@@ -1171,15 +1171,15 @@ typedef struct xfs_disk_dquot {__be32 d_rtbtimer;/* similar to above; for RT disk blocks */ __be16 d_rtbwarns;/* warnings issued wrt RT disk blocks */ __be16 d_pad; -} xfs_disk_dquot_t; +};/* * This is what goes on disk. This is separated from the xfs_disk_dquot because * carrying the unnecessary padding would be a waste of memory. */ typedef struct xfs_dqblk { - xfs_disk_dquot_t dd_diskdq; /* portion that lives incore as well */ - char dd_fill[4]; /* filling for posterity */ + struct xfs_disk_dquot dd_diskdq; /* portion living incore as well */ + char dd_fill[4];/* filling for posterity */ /* * These two are only present on filesystems with the CRC bits set.
fs/xfs/libxfs/xfs_trans_resv.c +0 -1
@@ -718,7 +718,6 @@ xfs_calc_clear_agi_bucket_reservation(/* * Adjusting quota limits. -* the xfs_disk_dquot_t: sizeof(struct xfs_disk_dquot) */ STATIC uintxfs_calc_qm_setqlim_reservation (void )
fs/xfs/xfs_dquot.c +9 -9
@@ -48,7 +48,7 @@ static struct lock_class_key xfs_dquot_project_class;*/ void xfs_qm_dqdestroy ( -xfs_dquot_t *dqp) +struct xfs_dquot *dqp) {ASSERT (list_empty (&dqp->q_lru));
@@ -113,8 +113,8 @@ xfs_qm_adjust_dqlimits(*/ void xfs_qm_adjust_dqtimers ( -xfs_mount_t *mp, -xfs_disk_dquot_t *d) +struct xfs_mount *mp, +struct xfs_disk_dquot *d) {ASSERT (d->d_id);
@@ -497,7 +497,7 @@ xfs_dquot_from_disk(struct xfs_disk_dquot *ddqp = bp->b_addr + dqp->q_bufoffset;/* copy everything from disk dquot to the incore dquot */ -memcpy (&dqp->q_core, ddqp,sizeof (xfs_disk_dquot_t)); +memcpy (&dqp->q_core, ddqp,sizeof (struct xfs_disk_dquot ));/* * Reservation counters are defined as reservation plus current usage
@@ -989,7 +989,7 @@ xfs_qm_dqput(*/ void xfs_qm_dqrele ( -xfs_dquot_t *dqp) +struct xfs_dquot *dqp) {if (!dqp)return ;
@@ -1019,7 +1019,7 @@ xfs_qm_dqflush_done( struct xfs_log_item *lip) {xfs_dq_logitem_t *qip = (struct xfs_dq_logitem *)lip; -xfs_dquot_t *dqp = qip->qli_dquot; +struct xfs_dquot *dqp = qip->qli_dquot;struct xfs_ail *ailp = lip->li_ailp;/*
@@ -1130,7 +1130,7 @@ xfs_qm_dqflush( }/* This is the only portion of data that needs to persist */ -memcpy (ddqp, &dqp->q_core,sizeof (xfs_disk_dquot_t)); +memcpy (ddqp, &dqp->q_core,sizeof (struct xfs_disk_dquot ));/* * Clear the dirty field and remember the flush lsn for later use.
@@ -1188,8 +1188,8 @@ xfs_qm_dqflush(*/ void xfs_dqlock2 ( -xfs_dquot_t *d1, -xfs_dquot_t *d2) +struct xfs_dquot *d1, +struct xfs_dquot *d2) {if (d1 && d2) {ASSERT (d1 != d2);
fs/xfs/xfs_dquot.h +64 -47
152 lines not on this page · raw message
fs/xfs/xfs_log_recover.c +3 -2
@@ -2576,6 +2576,7 @@ xlog_recover_do_reg_buffer(int bit;int nbits;xfs_failaddr_t fa; +const size_t size_disk_dquot =sizeof (struct xfs_disk_dquot );trace_xfs_log_recover_buf_reg_buf (mp->m_log, buf_f);
@@ -2618,7 +2619,7 @@ xlog_recover_do_reg_buffer( "XFS: NULL dquot in %s.", __func__); goto next; } -if (item->ri_buf[i].i_len <sizeof (xfs_disk_dquot_t)) { +if (item->ri_buf[i].i_len < size_disk_dquot) {xfs_alert (mp,"XFS: dquot too small (%d) in %s." , item->ri_buf[i].i_len, __func__);
@@ -3249,7 +3250,7 @@ xlog_recover_dquot_pass2(xfs_alert (log->l_mp,"NULL dquot in %s." , __func__);return -EIO ; } -if (item->ri_buf[1 ].i_len <sizeof (xfs_disk_dquot_t)) { +if (item->ri_buf[1 ].i_len <sizeof (struct xfs_disk_dquot )) {xfs_alert (log->l_mp,"dquot too small (%d) in %s." , item->ri_buf[1 ].i_len, __func__);return -EIO ;
fs/xfs/xfs_qm.c +15 -15
@@ -244,14 +244,14 @@ xfs_qm_unmount_quotas( STATIC intxfs_qm_dqattach_one ( -xfs_inode_t *ip, -xfs_dqid_t id, -uint type, -bool doalloc, -xfs_dquot_t **IO_idqpp) +struct xfs_inode *ip, +xfs_dqid_t id, +uint type, +bool doalloc, +struct xfs_dquot **IO_idqpp) { -xfs_dquot_t *dqp; -int error; +struct xfs_dquot *dqp; +int error;ASSERT (xfs_isilocked (ip,XFS_ILOCK_EXCL )); error =0 ;
@@ -544,8 +544,8 @@ xfs_qm_set_defquota(uint type, xfs_quotainfo_t *qinf) { - xfs_dquot_t *dqp; -struct xfs_def_quota *defq; + struct xfs_dquot *dqp; +struct xfs_def_quota *defq;struct xfs_disk_dquot *ddqp;int error;
@@ -1746,14 +1746,14 @@ xfs_qm_vop_dqalloc(* Actually transfer ownership, and do dquot modifications. * These were already reserved. */ -xfs_dquot_t * +struct xfs_dquot *xfs_qm_vop_chown ( -xfs_trans_t *tp, -xfs_inode_t *ip, -xfs_dquot_t **IO_olddq, -xfs_dquot_t *newdq) +struct xfs_trans *tp, +struct xfs_inode *ip, +struct xfs_dquot **IO_olddq, +struct xfs_dquot *newdq) { -xfs_dquot_t *prevdq; +struct xfs_dquot *prevdq;uint bfield =XFS_IS_REALTIME_INODE (ip) ?XFS_TRANS_DQ_RTBCOUNT :XFS_TRANS_DQ_BCOUNT ;
fs/xfs/xfs_qm_bhv.c +3 -3
@@ -54,11 +54,11 @@ xfs_fill_statvfs_from_dquot(*/ void xfs_qm_statvfs ( -xfs_inode_t *ip, +struct xfs_inode *ip,struct kstatfs *statp) { -xfs_mount_t *mp = ip->i_mount; -xfs_dquot_t *dqp; +struct xfs_mount *mp = ip->i_mount; +struct xfs_dquot *dqp;if (!xfs_qm_dqget (mp,xfs_get_projid (ip),XFS_DQ_PROJ , false, &dqp)) {xfs_fill_statvfs_from_dquot (statp, dqp);
fs/xfs/xfs_trans_dquot.c +21 -21
70 lines not on this page · raw message
Signature · 1 line
2.23.0
Re: [PATCH v3 1/4] xfs: remove the xfs_disk_dquot_t and xfs_dquot_t
Quoted 1 line · Pavel Reichl
Signed-off-by Pavel Reichl <[email protected]>
Looks good, but on minor nit.
<snip>
Personally, I'd just strip most of the comments here completely as the variable names describe the function of them almost entirely. This was an old pattern from Irix days, and we've slowly been removing it as we go as it's mostly clutter and largely redundant due to the code itself being self describing. Such as:
Quoted 19 lines
fs/xfs/xfs_dquot.h +0
-15@@ -30,33 +30,51 @@ enum {/* * The incore dquot structure */ -typedef struct xfs_dquot { - uint dq_flags; /* various flags (XFS_DQ_*) */ - struct list_head q_lru; /* global free list of dquots */ - struct xfs_mount*q_mount; /* filesystem this relates to */ - uint q_nrefs; /* # active refs from inodes */ - xfs_daddr_t q_blkno; /* blkno of dquot buffer */ - int q_bufoffset; /* off of dq in buffer (# dquots) */ - xfs_fileoff_t q_fileoffset; /* offset in quotas file */ - - xfs_disk_dquot_t q_core; /* actual usage & quotas */ - xfs_dq_logitem_t q_logitem; /* dquot log item */ - xfs_qcnt_t q_res_bcount; /* total regular nblks used+reserved */ - xfs_qcnt_t q_res_icount; /* total inos allocd+reserved */ - xfs_qcnt_t q_res_rtbcount;/* total realtime blks used+reserved */ - xfs_qcnt_t q_prealloc_lo_wmark;/* prealloc throttle wmark */
fs/xfs/xfs_dquot.h enum { · line 35
Quoted 10 lines
fs/xfs/xfs_dquot.h +3
-7-xfs_qcnt_t q_prealloc_hi_wmark;/* prealloc disabled wmark */ -int64_t q_low_space[XFS_QLOWSP_MAX ]; -struct mutex q_qlock;/* quota lock */ -struct completion q_flush;/* flush completion queue */ -atomic_t q_pincount;/* dquot pin count */ -wait_queue_head_t q_pinwait;/* dquot pinning wait queue */ -} xfs_dquot_t; +struct xfs_dquot { +/* various flags (XFS_DQ_*) */ +uint dq_flags;
Convention: xx_flags contain various flags for xx. Self documenting.
fs/xfs/xfs_dquot.h enum { · line 37
Quoted 2 lines
fs/xfs/xfs_dquot.h +2
-0+/* global free list of dquots */ +struct list_head q_lru;
Convention - xx_lru generally points to a LRU ordered free list. Self documenting.
fs/xfs/xfs_dquot.h enum { · line 39
Quoted 2 lines
fs/xfs/xfs_dquot.h +2
-0+/* filesystem this relates to */ +struct xfs_mount *q_mount;
Convention - xx_mount always points to the filesystem context. Self documenting.
fs/xfs/xfs_dquot.h enum { · line 41
Quoted 2 lines
fs/xfs/xfs_dquot.h +2
-0+/* # active refs from inodes */ +uint q_nrefs;
Convention: xx_refs is always an object reference count. Self documenting.
fs/xfs/xfs_dquot.h enum { · line 43
Quoted 2 lines
fs/xfs/xfs_dquot.h +2
-0+/* blkno of dquot buffer */ +xfs_daddr_t q_blkno;
Convention: xfs_daddr_t = disk address, blkno = block number. Reads as "block number on disk of quota object". Self documenting.
fs/xfs/xfs_dquot.h enum { · line 45
Quoted 2 lines
fs/xfs/xfs_dquot.h +2
-0+/* off of dq in buffer (# dquots) */ +int q_bufoffset;
That comment is wrong. It's not an offset in "# dquots", it's a byte offset from the start of the buffer. So, the comment should be removed because plain offsets are in bytes by convention and so "int q_bufoffset;" is actually self documenting.
fs/xfs/xfs_dquot.h enum { · line 52
Quoted 6 lines
fs/xfs/xfs_dquot.h +6
-0+/* offset in quotas file */ +xfs_fileoff_t q_fileoffset; +/* actual usage & quotas */ +struct xfs_disk_dquot q_core; +/* dquot log item */ +xfs_dq_logitem_t q_logitem;
These are all self documenting, follow convention.
fs/xfs/xfs_dquot.h enum { · line 58
Quoted 6 lines
fs/xfs/xfs_dquot.h +6
-0+/* total regular nblks used+reserved */ +xfs_qcnt_t q_res_bcount; +/* total inos allocd+reserved */ +xfs_qcnt_t q_res_icount; +/* total realtime blks used+reserved */ +xfs_qcnt_t q_res_rtbcount;
These are actually Useful comments, because they count both used and reserved objects.
fs/xfs/xfs_dquot.h enum { · line 62
Quoted 4 lines
fs/xfs/xfs_dquot.h +4
-0+/* prealloc throttle wmark */ +xfs_qcnt_t q_prealloc_lo_wmark; +/* prealloc disabled wmark */ +xfs_qcnt_t q_prealloc_hi_wmark;
Obvious from the name - watermarks are preallocation thresholds.
fs/xfs/xfs_dquot.h enum { · line 63
Quoted 1 line
fs/xfs/xfs_dquot.h +1
-0+int64_t q_low_space[XFS_QLOWSP_MAX ];
I never commented this one when I added it because it can't be described in 3-4 words. :)
fs/xfs/xfs_dquot.h enum { · line 71
Quoted 8 lines
fs/xfs/xfs_dquot.h +8
-0+/* quota lock */ +struct mutex q_qlock; +/* flush completion queue */ +struct completion q_flush; +/* dquot pin count */ +atomic_t q_pincount; +/* dquot pinning wait queue */ +struct wait_queue_head q_pinwait;
And these are all self documenting.
So, really, most of the comments can be removed from this structure. The only reason for a comment describing a variable is if it's function or contents is not obvious from it's name, such as the accounting variables above.
Note that we do the same thing to local variable declarations as we are changing them. The original Irix code had the same comment convention for function and local declarations - it's largely just clutter and noise now, so we also remove them as we go...
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
PATCH v3 2/4 xfs: remove the xfs_quotainfo_t typedef
In reply to Pavel Reichl--- fs/xfs/xfs_qm.c | 20 ++++++++++---------- fs/xfs/xfs_qm.h | 6 +++--- fs/xfs/xfs_trans_dquot.c | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-)
fs/xfs/xfs_qm.c +10 -10
@@ -30,10 +30,10 @@* quota functionality, including maintaining the freelist and hash * tables of dquots. */ -STATIC int xfs_qm_init_quotainos(xfs_mount_t *); -STATIC int xfs_qm_init_quotainfo(xfs_mount_t *); +STATIC int xfs_qm_init_quotainos(struct xfs_mount *mp); +STATIC int xfs_qm_init_quotainfo(struct xfs_mount *mp); -STATIC void xfs_qm_destroy_quotainos(xfs_quotainfo_t *qi); +STATIC void xfs_qm_destroy_quotainos(struct xfs_quotainfo *qi); STATIC void xfs_qm_dqfree_one(struct xfs_dquot *dqp);/* * We use the batch lookup interface to iterate over the dquots as it
@@ -540,9 +540,9 @@ xfs_qm_shrink_count( STATIC voidxfs_qm_set_defquota ( -xfs_mount_t *mp, -uint type, -xfs_quotainfo_t *qinf) +struct xfs_mount *mp, +uint type, +struct xfs_quotainfo *qinf) {struct xfs_dquot *dqp;struct xfs_def_quota *defq;
@@ -643,7 +643,7 @@ xfs_qm_init_quotainfo(ASSERT (XFS_IS_QUOTA_RUNNING (mp)); - qinf = mp->m_quotainfo =kmem_zalloc (sizeof (xfs_quotainfo_t),0 ); + qinf = mp->m_quotainfo =kmem_zalloc (sizeof (struct xfs_quotainfo ),0 ); error =list_lru_init (&qinf->qi_lru);if (error)
@@ -710,9 +710,9 @@ xfs_qm_init_quotainfo(*/ void xfs_qm_destroy_quotainfo ( -xfs_mount_t *mp) +struct xfs_mount *mp) { -xfs_quotainfo_t *qi; +struct xfs_quotainfo *qi; qi = mp->m_quotainfo;ASSERT (qi !=NULL );
@@ -1568,7 +1568,7 @@ xfs_qm_init_quotainos( STATIC voidxfs_qm_destroy_quotainos ( -xfs_quotainfo_t *qi) +struct xfs_quotainfo *qi) {if (qi->qi_uquotaip) {xfs_irele (qi->qi_uquotaip);
fs/xfs/xfs_qm.h +3 -3
@@ -54,7 +54,7 @@ struct xfs_def_quota {* Various quota information for individual filesystems. * The mount structure keeps a pointer to this. */ -typedef struct xfs_quotainfo { +struct xfs_quotainfo {struct radix_tree_root qi_uquota_tree;struct radix_tree_root qi_gquota_tree;struct radix_tree_root qi_pquota_tree;
@@ -76,8 +76,8 @@ typedef struct xfs_quotainfo {struct xfs_def_quota qi_usr_default;struct xfs_def_quota qi_grp_default;struct xfs_def_quota qi_prj_default; -struct shrinker qi_shrinker; -} xfs_quotainfo_t; +struct shrinker qi_shrinker; +};static inline struct radix_tree_root * xfs_dquot_tree(
fs/xfs/xfs_trans_dquot.c +1 -1
@@ -585,7 +585,7 @@ xfs_trans_dqresv(xfs_qwarncnt_t warnlimit;xfs_qcnt_t total_count;xfs_qcnt_t *resbcountp; -xfs_quotainfo_t *q = mp->m_quotainfo; +struct xfs_quotainfo *q = mp->m_quotainfo;struct xfs_def_quota *defq;
Signature · 1 line
2.23.0
Re: [PATCH v3 2/4] xfs: remove the xfs_quotainfo_t typedef
Quoted 6 lines · Pavel Reichl
Signed-off-by Pavel Reichl <[email protected]>--- fs/xfs/xfs_qm.c | 20 ++++++++++---------- fs/xfs/xfs_qm.h | 6 +++--- fs/xfs/xfs_trans_dquot.c | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-)
Looks good,
Signature · 2 lines
Dave Chinner [email protected]
PATCH v3 3/4 xfs: remove the xfs_dq_logitem_t typedef
In reply to Pavel Reichl--- fs/xfs/xfs_dquot.c | 2 +- fs/xfs/xfs_dquot.h | 2 +- fs/xfs/xfs_dquot_item.h | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-)
fs/xfs/xfs_dquot.c +1 -1
@@ -1018,7 +1018,7 @@ xfs_qm_dqflush_done(struct xfs_buf *bp, struct xfs_log_item *lip) { - xfs_dq_logitem_t *qip = (struct xfs_dq_logitem *)lip; + struct xfs_dq_logitem *qip = (struct xfs_dq_logitem *)lip;struct xfs_dquot *dqp = qip->qli_dquot;struct xfs_ail *ailp = lip->li_ailp;
fs/xfs/xfs_dquot.h +1 -1
@@ -49,7 +49,7 @@ struct xfs_dquot {/* actual usage & quotas */ struct xfs_disk_dquot q_core;/* dquot log item */ -xfs_dq_logitem_t q_logitem; +struct xfs_dq_logitem q_logitem;/* total regular nblks used+reserved */ xfs_qcnt_t q_res_bcount;/* total inos allocd+reserved */
fs/xfs/xfs_dquot_item.h +5 -5
@@ -11,11 +11,11 @@ struct xfs_trans;struct xfs_mount ;struct xfs_qoff_logitem ; -typedef struct xfs_dq_logitem { -struct xfs_log_item qli_item;/* common portion */ -struct xfs_dquot *qli_dquot;/* dquot ptr */ -xfs_lsn_t qli_flush_lsn;/* lsn at last flush */ -}xfs_dq_logitem_t ; +struct xfs_dq_logitem { +struct xfs_log_item qli_item;/* common portion */ +struct xfs_dquot *qli_dquot;/* dquot ptr */ +xfs_lsn_t qli_flush_lsn;/* lsn at last flush */ +}; typedef struct xfs_qoff_logitem { struct xfs_log_item qql_item; /* common portion */
Signature · 1 line
2.23.0
Re: [PATCH v3 3/4] xfs: remove the xfs_dq_logitem_t typedef
Quoted 6 lines · Pavel Reichl
Signed-off-by Pavel Reichl <[email protected]>--- fs/xfs/xfs_dquot.c | 2 +- fs/xfs/xfs_dquot.h | 2 +- fs/xfs/xfs_dquot_item.h | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-)
easy one! Looks fine.
Signature · 2 lines
Dave Chinner [email protected]
PATCH v3 4/4 xfs: remove the xfs_qoff_logitem_t typedef
In reply to Pavel Reichl--- fs/xfs/libxfs/xfs_trans_resv.c | 4 ++-- fs/xfs/xfs_dquot_item.h | 28 +++++++++++++++------------- fs/xfs/xfs_qm_syscalls.c | 29 ++++++++++++++++------------- fs/xfs/xfs_trans_dquot.c | 14 +++++++------- 4 files changed, 40 insertions(+), 35 deletions(-)
fs/xfs/libxfs/xfs_trans_resv.c +2 -2
@@ -741,7 +741,7 @@ xfs_calc_qm_dqalloc_reservation(/* * Turning off quotas. -* the xfs_qoff_logitem_t: sizeof(struct xfs_qoff_logitem) * 2 +* sizeof(struct xfs_qoff_logitem) * 2 * the superblock for the quota flags: sector size */ STATIC uint
@@ -754,7 +754,7 @@ xfs_calc_qm_quotaoff_reservation(/* * End of turning off quotas. -* the xfs_qoff_logitem_t: sizeof(struct xfs_qoff_logitem) * 2 +* sizeof(struct xfs_qoff_logitem) * 2 */ STATIC uintxfs_calc_qm_quotaoff_end_reservation (void )
fs/xfs/xfs_dquot_item.h +15 -13
@@ -12,24 +12,26 @@ struct xfs_mount;struct xfs_qoff_logitem ;struct xfs_dq_logitem { -struct xfs_log_item qli_item;/* common portion */ +struct xfs_log_item qli_item;/* common portion */ struct xfs_dquot *qli_dquot;/* dquot ptr */ -xfs_lsn_t qli_flush_lsn;/* lsn at last flush */ +xfs_lsn_t qli_flush_lsn;/* lsn at last flush */ }; -typedef struct xfs_qoff_logitem { -struct xfs_log_item qql_item;/* common portion */ -struct xfs_qoff_logitem *qql_start_lip;/* qoff-start logitem, if any */ +struct xfs_qoff_logitem { +struct xfs_log_item qql_item;/* common portion */ +struct xfs_qoff_logitem *qql_start_lip;/* qoff-start logitem, if any */ unsigned int qql_flags; -}xfs_qoff_logitem_t ; +}; -extern void xfs_qm_dquot_logitem_init (struct xfs_dquot *); -extern xfs_qoff_logitem_t *xfs_qm_qoff_logitem_init (struct xfs_mount *, -struct xfs_qoff_logitem *,uint ); -extern xfs_qoff_logitem_t *xfs_trans_get_qoff_item (struct xfs_trans *, -struct xfs_qoff_logitem *,uint ); -extern void xfs_trans_log_quotaoff_item (struct xfs_trans *, -struct xfs_qoff_logitem *); +void xfs_qm_dquot_logitem_init (struct xfs_dquot *dqp); +struct xfs_qoff_logitem *xfs_qm_qoff_logitem_init (struct xfs_mount *mp, +struct xfs_qoff_logitem *start, +uint flags); +struct xfs_qoff_logitem *xfs_trans_get_qoff_item (struct xfs_trans *tp, +struct xfs_qoff_logitem *startqoff, +uint flags); +void xfs_trans_log_quotaoff_item (struct xfs_trans *tp, +struct xfs_qoff_logitem *qlp);#endif /* __XFS_DQUOT_ITEM_H__ */
fs/xfs/xfs_qm_syscalls.c +16 -13
@@ -19,9 +19,12 @@#include "xfs_qm.h" #include "xfs_icache.h" -STATIC int xfs_qm_log_quotaoff(xfs_mount_t *, xfs_qoff_logitem_t **, uint); -STATIC int xfs_qm_log_quotaoff_end(xfs_mount_t *, xfs_qoff_logitem_t *, -uint ); +STATIC int xfs_qm_log_quotaoff(struct xfs_mount *mp, +struct xfs_qoff_logitem **qoffstartp, +uint flags); +STATIC int xfs_qm_log_quotaoff_end(struct xfs_mount *mp, +struct xfs_qoff_logitem *startqoff, +uint flags);/* * Turn off quota accounting and/or enforcement for all udquots and/or
@@ -40,7 +43,7 @@ xfs_qm_scall_quotaoff(uint dqtype;int error;uint inactivate_flags; -xfs_qoff_logitem_t *qoffstart; +struct xfs_qoff_logitem *qoffstart;/* * No file system can have quotas enabled on disk but not in core.
@@ -540,13 +543,13 @@ xfs_qm_scall_setqlim( STATIC intxfs_qm_log_quotaoff_end ( -xfs_mount_t *mp, -xfs_qoff_logitem_t *startqoff, +struct xfs_mount *mp, +struct xfs_qoff_logitem *startqoff,uint flags) { -xfs_trans_t *tp; +struct xfs_trans *tp;int error; -xfs_qoff_logitem_t *qoffi; +struct xfs_qoff_logitem *qoffi; error =xfs_trans_alloc (mp, &M_RES (mp)->tr_qm_equotaoff,0 ,0 ,0 , &tp);if (error)
@@ -568,13 +571,13 @@ xfs_qm_log_quotaoff_end( STATIC intxfs_qm_log_quotaoff ( -xfs_mount_t *mp, -xfs_qoff_logitem_t **qoffstartp, -uint flags) +struct xfs_mount *mp, +struct xfs_qoff_logitem **qoffstartp, +uint flags) { -xfs_trans_t *tp; +struct xfs_trans *tp;int error; -xfs_qoff_logitem_t *qoffi; +struct xfs_qoff_logitem *qoffi; *qoffstartp =NULL ;
fs/xfs/xfs_trans_dquot.c +7 -7
@@ -824,13 +824,13 @@ xfs_trans_reserve_quota_nblks(/* * This routine is called to allocate a quotaoff log item. */ -xfs_qoff_logitem_t * +struct xfs_qoff_logitem *xfs_trans_get_qoff_item ( -xfs_trans_t *tp, -xfs_qoff_logitem_t *startqoff, -uint flags) +struct xfs_trans *tp, +struct xfs_qoff_logitem *startqoff, +uint flags) { -xfs_qoff_logitem_t *q; +struct xfs_qoff_logitem *q;ASSERT (tp !=NULL );
@@ -852,8 +852,8 @@ xfs_trans_get_qoff_item(*/ void xfs_trans_log_quotaoff_item ( -xfs_trans_t *tp, -xfs_qoff_logitem_t *qlp) +struct xfs_trans *tp, +struct xfs_qoff_logitem *qlp) { tp->t_flags |=XFS_TRANS_DIRTY ;set_bit (XFS_LI_DIRTY , &qlp->qql_item.li_flags);
Signature · 1 line
2.23.0
Re: [PATCH v3 4/4] xfs: remove the xfs_qoff_logitem_t typedef
Quoted 13 lines · Pavel Reichl
Signed-off-by Pavel Reichl <[email protected]>--- fs/xfs/libxfs/xfs_trans_resv.c | 4 ++-- fs/xfs/xfs_dquot_item.h | 28 +++++++++++++++------------- fs/xfs/xfs_qm_syscalls.c | 29 ++++++++++++++++------------- fs/xfs/xfs_trans_dquot.c | 14 +++++++------- 4 files changed, 40 insertions(+), 35 deletions(-)fs/xfs/libxfs/xfs_trans_resv.c +0
-0
fs/xfs/libxfs/xfs_trans_resv.c xfs_calc_qm_dqalloc_reservation( · line 744
Quoted 5 lines
fs/xfs/libxfs/xfs_trans_resv.c +1
-1@@ -741,7 +741,7 @@ xfs_calc_qm_dqalloc_reservation(/* * Turning off quotas. -* the xfs_qoff_logitem_t: sizeof(struct xfs_qoff_logitem) * 2 +* sizeof(struct xfs_qoff_logitem) * 2
This should be
* the quota off logitems: sizeof(struct xfs_qoff_logitem) * 2
fs/xfs/libxfs/xfs_trans_resv.c xfs_calc_qm_quotaoff_reservation( · line 757
Quoted 9 lines
fs/xfs/libxfs/xfs_trans_resv.c +1
-1* the superblock for the quota flags: sector size */ STATIC uint@@ -754,7 +754,7 @@ xfs_calc_qm_quotaoff_reservation(/* * End of turning off quotas. -* the xfs_qoff_logitem_t: sizeof(struct xfs_qoff_logitem) * 2 +* sizeof(struct xfs_qoff_logitem) * 2
Ditto.
Quoted 35 lines
fs/xfs/libxfs/xfs_trans_resv.c +0
-0*/ STATIC uintxfs_calc_qm_quotaoff_end_reservation (void )fs/xfs/xfs_dquot_item.h +6
-12@@ -12,24 +12,26 @@ struct xfs_mount;struct xfs_qoff_logitem ;struct xfs_dq_logitem { -struct xfs_log_item qli_item;/* common portion */ +struct xfs_log_item qli_item;/* common portion */ struct xfs_dquot *qli_dquot;/* dquot ptr */ -xfs_lsn_t qli_flush_lsn;/* lsn at last flush */ +xfs_lsn_t qli_flush_lsn;/* lsn at last flush */ }; -typedef struct xfs_qoff_logitem { -struct xfs_log_item qql_item;/* common portion */ -struct xfs_qoff_logitem *qql_start_lip;/* qoff-start logitem, if any */ +struct xfs_qoff_logitem { +struct xfs_log_item qql_item;/* common portion */ +struct xfs_qoff_logitem *qql_start_lip;/* qoff-start logitem, if any */ unsigned int qql_flags; -}xfs_qoff_logitem_t ; +}; -extern void xfs_qm_dquot_logitem_init (struct xfs_dquot *); -extern xfs_qoff_logitem_t *xfs_qm_qoff_logitem_init (struct xfs_mount *, -struct xfs_qoff_logitem *,uint ); -extern xfs_qoff_logitem_t *xfs_trans_get_qoff_item (struct xfs_trans *, -struct xfs_qoff_logitem *,uint ); -extern void xfs_trans_log_quotaoff_item(struct xfs_trans *,
fs/xfs/xfs_dquot_item.h struct xfs_mount; · line 35
Quoted 10 lines
fs/xfs/xfs_dquot_item.h +9
-1- struct xfs_qoff_logitem *); +void xfs_qm_dquot_logitem_init (struct xfs_dquot *dqp); +struct xfs_qoff_logitem *xfs_qm_qoff_logitem_init (struct xfs_mount *mp, +struct xfs_qoff_logitem *start, +uint flags); +struct xfs_qoff_logitem *xfs_trans_get_qoff_item (struct xfs_trans *tp, +struct xfs_qoff_logitem *startqoff, +uint flags); +void xfs_trans_log_quotaoff_item (struct xfs_trans *tp, +struct xfs_qoff_logitem *qlp);
I'd get rid of the tabs completely here:
void xfs_qm_dquot_logitem_init(struct xfs_dquot *dqp); struct xfs_qoff_logitem *xfs_qm_qoff_logitem_init(struct xfs_mount *mp,
struct xfs_qoff_logitem *start, uint flags); struct xfs_qoff_logitem *xfs_trans_get_qoff_item(struct xfs_trans *tp, struct xfs_qoff_logitem *startqoff, uint flags); void xfs_trans_log_quotaoff_item(struct xfs_trans *tp, struct xfs_qoff_logitem *qlp);
Quoted 9 lines
fs/xfs/xfs_dquot_item.h +0
-0#endif /* __XFS_DQUOT_ITEM_H__ */ fs/xfs/xfs_qm_syscalls.c +0
-0@@ -19,9 +19,12 @@#include "xfs_qm.h" #include "xfs_icache.h"
fs/xfs/xfs_qm_syscalls.c line 27
Quoted 10 lines
fs/xfs/xfs_qm_syscalls.c +6
-3-STATIC int xfs_qm_log_quotaoff(xfs_mount_t *, xfs_qoff_logitem_t **, uint); -STATIC int xfs_qm_log_quotaoff_end(xfs_mount_t *, xfs_qoff_logitem_t *, -uint ); +STATIC int xfs_qm_log_quotaoff(struct xfs_mount *mp, +struct xfs_qoff_logitem **qoffstartp, +uint flags); +STATIC int xfs_qm_log_quotaoff_end(struct xfs_mount *mp, +struct xfs_qoff_logitem *startqoff, +uint flags);
And pull the indent back here.
STATIC int xfs_qm_log_quotaoff(struct xfs_mount *mp,
struct xfs_qoff_logitem **qoffstartp, uint flags); STATIC int xfs_qm_log_quotaoff_end(struct xfs_mount *mp, struct xfs_qoff_logitem *startqoff, uint flags);
Actaully, no, what would be better is another patch to move the xfs_qm_log_quotaoff() and xfs_qm_log_quotaoff_end() functions above the code that calls them, so the need for forward prototypes goes away completely. i.e. reformat in one patch, move in another (or the other way around). Code movement patches shouldn't make any other changes in them.
Quoted 26 lines
fs/xfs/xfs_qm_syscalls.c +5
-5@@ -568,13 +571,13 @@ xfs_qm_log_quotaoff_end( STATIC intxfs_qm_log_quotaoff ( -xfs_mount_t *mp, -xfs_qoff_logitem_t **qoffstartp, -uint flags) +struct xfs_mount *mp, +struct xfs_qoff_logitem **qoffstartp, +uint flags) { -xfs_trans_t *tp; +struct xfs_trans *tp;int error; -xfs_qoff_logitem_t *qoffi; +struct xfs_qoff_logitem *qoffi; *qoffstartp =NULL ;fs/xfs/xfs_trans_dquot.c +0
-0@@ -824,13 +824,13 @@ xfs_trans_reserve_quota_nblks(/* * This routine is called to allocate a quotaoff log item.
fs/xfs/xfs_trans_dquot.c xfs_trans_reserve_quota_nblks( · line 831
Quoted 10 lines
fs/xfs/xfs_trans_dquot.c +4
-4*/ -xfs_qoff_logitem_t * +struct xfs_qoff_logitem *xfs_trans_get_qoff_item ( -xfs_trans_t *tp, -xfs_qoff_logitem_t *startqoff, -uint flags) +struct xfs_trans *tp, +struct xfs_qoff_logitem *startqoff, +uint flags)
That doesn't look right. Extra tab before *tp, extra space before flags.
FWIW, I use this rule in vim to highlight stray whitespace:
" highlight whitespace damage
highlight RedundantSpaces ctermbg=red guibg=red
match RedundantSpaces /\s\+$\| \+\ze\t/
Modify the regex to suit the whitespace damage you want it to find...
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]