xfs: bug fixes, cleanups and tracing
cover xfs: bug fixes, cleanups and tracing
The first two patches are reposts of reviewed patches not yet in the dev tree. Christoph, the sync fix has been cleaned up like you suggested, you might want to pass an eye over it again.
The next two are log changes - the first is making the transaction ID that identifies transactions on disk really unique. The second is a bunch of tracing additions to log recovery that I wrote recently to track down an issue with delayed logging causing corruptions during recovery.
The last four are the start of cleaning up some of the dquot code. They basicaly remove all the hand coded linked list operations and obfuscated locking macros for all the lists that the dquots can exist on. One patch also removes a duplicated reclaim algorithm and uses the common function to implement both reclaim and shaking of dquots. I haven't done a huge amount of testing on these yet, but they've passed several runs of xfsqa on both single and quad processor VMs so far.
As usual, the series can also be found in my git tree...
The following changes since commit 68a2ac777cca40ccc993512bcf457999be71cc36:
Christoph Hellwig (1):
xfs: clean up xlog_write_adv_cnt
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/dgc/xfs.git working
Dave Chinner (8):
xfs: ensure that sync updates the log tail correctly
xfs: don't warn on EAGAIN in inode reclaim
xfs: make the log ticket transaction id random
xfs: add log item recovery tracing
xfs: convert the per-mount dquot list to use list heads
xfs: remove duplicate code from dquot reclaim
xfs: convert the dquot hash list to use list heads
xfs: convert the dquot free list to use list heads
fs/xfs/linux-2.6/xfs_sync.c | 4 +- fs/xfs/linux-2.6/xfs_trace.c | 3 + fs/xfs/linux-2.6/xfs_trace.h | 150 +++++++++++- fs/xfs/quota/xfs_dquot.c | 120 ++++------ fs/xfs/quota/xfs_dquot.h | 14 +- fs/xfs/quota/xfs_qm.c | 520 ++++++++++++++-------------------------- fs/xfs/quota/xfs_qm.h | 23 +-- fs/xfs/quota/xfs_qm_stats.c | 2 +- fs/xfs/quota/xfs_qm_syscalls.c | 36 +-- fs/xfs/quota/xfs_quota_priv.h | 75 ------ fs/xfs/xfs_buf_item.h | 2 +- fs/xfs/xfs_log.c | 40 ++- fs/xfs/xfs_log_recover.c | 44 +++- 13 files changed, 472 insertions(+), 561 deletions(-)
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/8 xfs: don't warn on EAGAIN in inode reclaim
From: Dave Chinner <[email protected]>
Any inode reclaim flush that returns EAGAIN will result in the inode reclaim being attempted again later. There is no need to issue a warning into the logs about this situation.
--- fs/xfs/linux-2.6/xfs_sync.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
fs/xfs/linux-2.6/xfs_sync.c +2 -2
@@ -820,10 +820,10 @@ xfs_reclaim_inode(* call into reclaim to find it in a clean state instead of waiting for * it now. We also don't return errors here - if the error is transient * then the next reclaim pass will flush the inode, and if the error -* is permanent then the next sync reclaim will relcaim the inode and +* is permanent then the next sync reclaim will reclaim the inode and * pass on the error. */ -if (error && !XFS_FORCED_SHUTDOWN (ip->i_mount)) { +if (error && error !=EAGAIN && !XFS_FORCED_SHUTDOWN (ip->i_mount)) {xfs_fs_cmn_err (CE_WARN , ip->i_mount,"inode 0x%llx background reclaim flush failed with %d" , (long long )ip->i_ino, error);
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 2/8] xfs: don't warn on EAGAIN in inode reclaim
Quoted 8 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Any inode reclaim flush that returns EAGAIN will result in the inode reclaim being attempted again later. There is no need to issue a warning into the logs about this situation.
Signed-off-by Dave Chinner <[email protected]>Reviewed-by Alex Elder <[email protected]>
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/8 xfs: make the log ticket transaction id random
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The transaction ID that is written to the log for a transaction is currently set by taking the lower 32 bits of the memory address of the ticket structure. This is not guaranteed to be unique as tickets comes from a slab and slots can be reallocated immediately after being freed. As a result, there is no guarantee of uniqueness in the ticket ID value.
Fix this by assigning a random number to the ticket ID field so that it is extremely unlikely that duplicates will occur and remove the possibility of transactions being mixed up during recovery due to duplicate IDs.
--- fs/xfs/xfs_log.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/xfs/xfs_log.c +1 -1
@@ -3417,7 +3417,7 @@ xlog_ticket_alloc( tic->t_curr_res = unit_bytes; tic->t_cnt = cnt; tic->t_ocnt = cnt; - tic->t_tid = (xlog_tid_t)((__psint_t )tic &0xffffffff ); + tic->t_tid =random32 (); tic->t_clientid = client; tic->t_flags =XLOG_TIC_INITED ; tic->t_trans_type =0 ;
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 3/8] xfs: make the log ticket transaction id random
Quoted 9 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The transaction ID that is written to the log for a transaction is currently set by taking the lower 32 bits of the memory address of the ticket structure. This is not guaranteed to be unique as tickets comes from a slab and slots can be reallocated immediately after being freed. As a result, there is no guarantee of uniqueness in the ticket ID value.
Quoted 4 lines
Fix this by assigning a random number to the ticket ID field so that it is extremely unlikely that duplicates will occur and remove the possibility of transactions being mixed up during recovery due to duplicate IDs.
I already noticed that you uses a random tid in your delayed logging patches. But even a random number means we can get duplicate tids. If we assign tids from a wrapping counter instead we can guarantee that they are unique as long as we don't have more than UINT_MAX transactions in the log, which is a limitation we could easily enforce.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 3/8] xfs: make the log ticket transaction id random
Quoted 10 lines · Christoph Hellwig
Quoted 9 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The transaction ID that is written to the log for a transaction is currently set by taking the lower 32 bits of the memory address of the ticket structure. This is not guaranteed to be unique as tickets comes from a slab and slots can be reallocated immediately after being freed. As a result, there is no guarantee of uniqueness in the ticket ID value.
Quoted 7 lines
Quoted 4 lines
Fix this by assigning a random number to the ticket ID field so that it is extremely unlikely that duplicates will occur and remove the possibility of transactions being mixed up during recovery due to duplicate IDs.
I already noticed that you uses a random tid in your delayed logging patches. But even a random number means we can get duplicate tids.
Agreed. However, random duplicates are much more unlikely, IMO, than memory addresses of slab objects. The existing code is giving quite regular duplicates according to the tracing I added, but I didn't find any from the sampling I did with this patch....
Quoted 3 lines
If we assign tids from a wrapping counter instead we can guarantee that they are unique as long as we don't have more than
UINT_MAXtransactions in the log, which is a limitation we could easily enforce.
Ideally, yes. However, I didn't want to introduce a global monatomically increasing counter into the transaction code. I'm seeing upwards of 50-60k transactions/s on my test box - that's getting into the range where reliable global counters become scalability limitations. I know this can be solved, but it is somewhat complex and I'm not sure at this point that the complexity is necessary. What do you think?
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 3/8] xfs: make the log ticket transaction id random
Quoted 7 lines · Dave Chinner
Ideally, yes. However, I didn't want to introduce a global monatomically increasing counter into the transaction code. I'm seeing upwards of 50-60k transactions/s on my test box - that's getting into the range where reliable global counters become scalability limitations. I know this can be solved, but it is somewhat complex and I'm not sure at this point that the complexity is necessary. What do you think?
I think making log revoery absolutely fail proof is nessecary, but for now your version defintively is an improvment over the current version, so ACK.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 4/8 xfs: add log item recovery tracing
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Currently there is no tracing in log recovery, so it is difficult to determine what is going on when something goes wrong.
Add tracing for log item recovery to provide visibility into the log recovery process. The tracing added shows regions being extracted from the log transactions and added to the transaction hash forming recovery items, followed by the reordering, cancelling and finally recovery of the items.
--- fs/xfs/linux-2.6/xfs_trace.c | 3 + fs/xfs/linux-2.6/xfs_trace.h | 147 ++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_buf_item.h | 2 +- fs/xfs/xfs_log_recover.c | 44 ++++++++++-- 4 files changed, 187 insertions(+), 9 deletions(-)
fs/xfs/linux-2.6/xfs_trace.c +3 -0
@@ -50,6 +50,9 @@#include "xfs_aops.h" #include "quota/xfs_dquot_item.h" #include "quota/xfs_dquot.h" +#include "xfs_log_recover.h" +#include "xfs_buf_item.h" +#include "xfs_inode_item.h" /* * We include this last to have the helpers above available for the trace
fs/xfs/linux-2.6/xfs_trace.h +147 -0
159 lines not on this page · raw message
fs/xfs/xfs_buf_item.h +1 -1
@@ -26,7 +26,7 @@ extern kmem_zone_t *xfs_buf_item_zone;* have been logged. * For 6.2 and beyond, this is XFS_LI_BUF. We use this to log everything. */ -typedef struct xfs_buf_log_format_t { +typedef struct xfs_buf_log_format { unsigned short blf_type; /* buf log item type indicator */ unsigned short blf_size; /* size of this item */ ushort blf_flags; /* misc state */
fs/xfs/xfs_log_recover.c +36 -8
186 lines not on this page · raw message
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 4/8] xfs: add log item recovery tracing
Quoted 20 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Currently there is no tracing in log recovery, so it is difficult to determine what is going on when something goes wrong.
Add tracing for log item recovery to provide visibility into the log recovery process. The tracing added shows regions being extracted from the log transactions and added to the transaction hash forming recovery items, followed by the reordering, cancelling and finally recovery of the items.
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/linux-2.6/xfs_trace.c | 3 + fs/xfs/linux-2.6/xfs_trace.h | 147 ++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_buf_item.h | 2 +- fs/xfs/xfs_log_recover.c | 44 ++++++++++-- 4 files changed, 187 insertions(+), 9 deletions(-)
fs/xfs/linux-2.6/xfs_trace.h DEFINE_EVENT(xfs_swap_extent_class, name, \ · line 1516
Quoted 8 lines
fs/xfs/linux-2.6/xfs_trace.h +8
-0+#define XFS_LOG_ITEM_TYPE \ + { 0x1236, "XFS_LI_EFI" }, \ + { 0x1237, "XFS_LI_EFD" }, \ + { 0x1238, "XFS_LI_IUNLINK" }, \ + { 0x123b, "XFS_LI_INODE" }, \ + { 0x123c, "XFS_LI_BUF" }, \ + { 0x123d, "XFS_LI_DQUOT" }, \ + { 0x123e, "XFS_LI_QUOTAOFF" }
For the other trace events I kept these close to the defintion of these flags. Is there a good reason you use the numerical and not hte symbolic names on the left side?
The rest of the patch looks good to me.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 4/8] xfs: add log item recovery tracing
Quoted 21 lines · Christoph Hellwig
Quoted 19 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Currently there is no tracing in log recovery, so it is difficult to determine what is going on when something goes wrong.
Add tracing for log item recovery to provide visibility into the log recovery process. The tracing added shows regions being extracted from the log transactions and added to the transaction hash forming recovery items, followed by the reordering, cancelling and finally recovery of the items.
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/linux-2.6/xfs_trace.c | 3 + fs/xfs/linux-2.6/xfs_trace.h | 147 ++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_buf_item.h | 2 +- fs/xfs/xfs_log_recover.c | 44 ++++++++++-- 4 files changed, 187 insertions(+), 9 deletions(-)
Quoted 11 lines
fs/xfs/linux-2.6/xfs_trace.h DEFINE_EVENT(xfs_swap_extent_class, name, \ · line 1516
Quoted 8 lines
fs/xfs/linux-2.6/xfs_trace.h +8
-0+#define XFS_LOG_ITEM_TYPE \ + { 0x1236, "XFS_LI_EFI" }, \ + { 0x1237, "XFS_LI_EFD" }, \ + { 0x1238, "XFS_LI_IUNLINK" }, \ + { 0x123b, "XFS_LI_INODE" }, \ + { 0x123c, "XFS_LI_BUF" }, \ + { 0x123d, "XFS_LI_DQUOT" }, \ + { 0x123e, "XFS_LI_QUOTAOFF" }For the other trace events I kept these close to the defintion of these flags.
np, I'll move it.
Quoted 2 lines
Is there a good reason you use the numerical
and not hte symbolic names on the left side?
Brain fart. I'll fix it up.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 5/8 xfs: convert the per-mount dquot list to use list heads
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Convert the dquot list on the filesytesm to use listhead infrastructure rather than the roll-your-own in the quota code.
--- fs/xfs/quota/xfs_dquot.c | 21 +++--- fs/xfs/quota/xfs_dquot.h | 2 +- fs/xfs/quota/xfs_qm.c | 155 +++++++++++++++++++++------------------- fs/xfs/quota/xfs_qm.h | 4 +- fs/xfs/quota/xfs_qm_syscalls.c | 2 +- fs/xfs/quota/xfs_quota_priv.h | 25 ------- 6 files changed, 97 insertions(+), 112 deletions(-)
fs/xfs/quota/xfs_dquot.c +12 -9
@@ -121,8 +121,9 @@ xfs_qm_dqinit(*/ dqp->q_nrefs =0 ; dqp->q_blkno =0 ; - dqp->MPL_NEXT = dqp->HL_NEXT =NULL ; - dqp->HL_PREVP = dqp->MPL_PREVP =NULL ; +INIT_LIST_HEAD (&dqp->q_mplist); + dqp->HL_NEXT =NULL ; + dqp->HL_PREVP =NULL ; dqp->q_bufoffset =0 ; dqp->q_fileoffset =0 ; dqp->q_transp =NULL ;
@@ -772,7 +773,7 @@ xfs_qm_dqlookup(/* * All in core dquots must be on the dqlist of mp */ -ASSERT (dqp->MPL_PREVP !=NULL ); +ASSERT (!list_empty (&dqp->q_mplist));xfs_dqlock (dqp);if (dqp->q_nrefs ==0 ) {
@@ -1039,7 +1040,7 @@ xfs_qm_dqget(* Attach this dquot to this filesystem's list of all dquots, * kept inside the mount structure in m_quotainfo field */ -xfs_qm_mplist_lock (mp); +mutex_lock (&mp->m_quotainfo->qi_dqlist_lock);/* * We return a locked dquot to the caller, with a reference taken
@@ -1047,9 +1048,9 @@ xfs_qm_dqget(xfs_dqlock (dqp); dqp->q_nrefs =1 ; -XQM_MPLIST_INSERT (&(XFS_QI_MPL_LIST (mp)), dqp); - -xfs_qm_mplist_unlock (mp); +list_add (&dqp->q_mplist, &mp->m_quotainfo->qi_dqlist); + mp->m_quotainfo->qi_dquots++; +mutex_unlock (&mp->m_quotainfo->qi_dqlist_lock);mutex_unlock (&h->qh_lock); dqret:ASSERT ((ip ==NULL ) ||xfs_isilocked (ip,XFS_ILOCK_EXCL ));
@@ -1389,7 +1390,7 @@ xfs_qm_dqpurge(xfs_dqhash_t *thishash;xfs_mount_t *mp = dqp->q_mount; -ASSERT (XFS_QM_IS_MPLIST_LOCKED (mp)); +ASSERT (mutex_is_locked (&mp->m_quotainfo->qi_dqlist_lock));ASSERT (mutex_is_locked (&dqp->q_hash->qh_lock));xfs_dqlock (dqp);
@@ -1454,7 +1455,9 @@ xfs_qm_dqpurge( thishash = dqp->q_hash;XQM_HASHLIST_REMOVE (thishash, dqp); -XQM_MPLIST_REMOVE (&(XFS_QI_MPL_LIST (mp)), dqp); +list_del_init (&dqp->q_mplist); + mp->m_quotainfo->qi_dqreclaims++; + mp->m_quotainfo->qi_dquots--;/* * XXX Move this to the front of the freelist, if we can get the * freelist lock.
fs/xfs/quota/xfs_dquot.h +1 -1
@@ -57,7 +57,6 @@ struct xfs_trans;typedef struct xfs_dqmarker {struct xfs_dquot *dqm_flnext;/* link to freelist: must be first */ struct xfs_dquot *dqm_flprev; -xfs_dqlink_t dqm_mplist;/* link to mount's list of dquots */ xfs_dqlink_t dqm_hashlist;/* link to the hash chain */ uint dqm_flags;/* various flags (XFS_DQ_*) */ }xfs_dqmarker_t ;
@@ -67,6 +66,7 @@ typedef struct xfs_dqmarker {*/ typedef struct xfs_dquot { xfs_dqmarker_t q_lists; /* list ptrs, q_flags (marker) */ + struct list_head q_mplist; /* mount's list of dquots */ xfs_dqhash_t *q_hash; /* the hashchain header */ struct xfs_mount*q_mount; /* filesystem this relates to */ struct xfs_trans*q_transp; /* trans this belongs to currently */
fs/xfs/quota/xfs_qm.c +80 -75
405 lines not on this page · raw message
fs/xfs/quota/xfs_qm.h +3 -1
@@ -106,7 +106,9 @@ typedef struct xfs_qm { typedef struct xfs_quotainfo { xfs_inode_t *qi_uquotaip; /* user quota inode */ xfs_inode_t *qi_gquotaip; /* group quota inode */ - xfs_dqlist_t qi_dqlist; /* all dquots in filesys */ + struct list_head qi_dqlist; /* all dquots in filesys */ + struct mutex qi_dqlist_lock; + int qi_dquots; int qi_dqreclaims; /* a change here indicates a removal in the dqlist */ time_t qi_btimelimit; /* limit for blks timer */
fs/xfs/quota/xfs_qm_syscalls.c +1 -1
@@ -442,7 +442,7 @@ xfs_qm_scall_getqstat(IRELE (gip); }if (mp->m_quotainfo) { - out->qs_incoredqs =XFS_QI_MPLNDQUOTS (mp); + out->qs_incoredqs = mp->m_quotainfo->qi_dquots; out->qs_btimelimit =XFS_QI_BTIMELIMIT (mp); out->qs_itimelimit =XFS_QI_ITIMELIMIT (mp); out->qs_rtbtimelimit =XFS_QI_RTBTIMELIMIT (mp);
fs/xfs/quota/xfs_quota_priv.h +0 -25
@@ -29,7 +29,6 @@#define XFS_DQ_IS_ADDEDTO_TRX (t, d) ((d)->q_transp == (t)) -#define XFS_QI_MPLRECLAIMS (mp) ((mp)->m_quotainfo->qi_dqreclaims)#define XFS_QI_UQIP (mp) ((mp)->m_quotainfo->qi_uquotaip)#define XFS_QI_GQIP (mp) ((mp)->m_quotainfo->qi_gquotaip)#define XFS_QI_DQCHUNKLEN (mp) ((mp)->m_quotainfo->qi_dqchunklen)
@@ -41,19 +40,6 @@#define XFS_QI_IWARNLIMIT (mp) ((mp)->m_quotainfo->qi_iwarnlimit)#define XFS_QI_QOFFLOCK (mp) ((mp)->m_quotainfo->qi_quotaofflock) -#define XFS_QI_MPL_LIST (mp) ((mp)->m_quotainfo->qi_dqlist) -#define XFS_QI_MPLNEXT (mp) ((mp)->m_quotainfo->qi_dqlist.qh_next) -#define XFS_QI_MPLNDQUOTS (mp) ((mp)->m_quotainfo->qi_dqlist.qh_nelems) - -#define xfs_qm_mplist_lock (mp) \ - mutex_lock(&(XFS_QI_MPL_LIST(mp).qh_lock)) -#define xfs_qm_mplist_nowait (mp) \ - mutex_trylock(&(XFS_QI_MPL_LIST(mp).qh_lock)) -#define xfs_qm_mplist_unlock (mp) \ - mutex_unlock(&(XFS_QI_MPL_LIST(mp).qh_lock)) -#define XFS_QM_IS_MPLIST_LOCKED (mp) \ - mutex_is_locked(&(XFS_QI_MPL_LIST(mp).qh_lock)) -#define xfs_qm_freelist_lock (qm) \ mutex_lock(&((qm)->qm_dqfreelist.qh_lock))#define xfs_qm_freelist_lock_nowait (qm) \
@@ -88,8 +74,6 @@#define HL_PREVP dq_hashlist.ql_prevp#define HL_NEXT dq_hashlist.ql_next -#define MPL_PREVP dq_mplist.ql_prevp -#define MPL_NEXT dq_mplist.ql_next#define _LIST_REMOVE (h, dqp,PVP ,NXT ) \
@@ -116,9 +100,6 @@ (h)->qh_nelems++; \ } -#define FOREACH_DQUOT_IN_MP (dqp, mp) \ - for ((dqp) = XFS_QI_MPLNEXT(mp); (dqp) != NULL; (dqp) = (dqp)->MPL_NEXT) -#define FOREACH_DQUOT_IN_FREELIST (dqp, qlist) \ for ((dqp) = (qlist)->qh_next; (dqp) != (xfs_dquot_t *)(qlist); \ (dqp) = (dqp)->dq_flnext)
@@ -129,16 +110,10 @@ for ((dqp) = (qlist)->qh_next; (dqp) != (xfs_dquot_t *)(qlist); \#define XQM_FREELIST_INSERT (h, dqp) \ xfs_qm_freelist_append(h, dqp) -#define XQM_MPLIST_INSERT (h, dqp) \ - _LIST_INSERT(h, dqp, MPL_PREVP, MPL_NEXT) -#define XQM_HASHLIST_REMOVE (h, dqp) \ _LIST_REMOVE(h, dqp, HL_PREVP, HL_NEXT)#define XQM_FREELIST_REMOVE (dqp) \ xfs_qm_freelist_unlink(dqp) -#define XQM_MPLIST_REMOVE (h, dqp) \ - { _LIST_REMOVE(h, dqp, MPL_PREVP, MPL_NEXT); \ - XFS_QI_MPLRECLAIMS((dqp)->q_mount)++; }#define XFS_DQ_IS_LOGITEM_INITD (dqp) ((dqp)->q_logitem.qli_dquot == (dqp))
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 5/8] xfs: convert the per-mount dquot list to use list heads
Quoted 6 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Convert the dquot list on the filesytesm to use listhead infrastructure rather than the roll-your-own in the quota code.
Signed-off-by Dave Chinner <[email protected]>
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 6/8 xfs: remove duplicate code from dquot reclaim
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The dquot shaker and the free-list reclaim code use exactly the same algorithm but the code is duplicated and slightly different in each case. Make the shaker code use the single dquot reclaim code to remove the code duplication.
--- fs/xfs/linux-2.6/xfs_trace.h | 2 - fs/xfs/quota/xfs_qm.c | 269 ++++++++++++------------------------------ 2 files changed, 78 insertions(+), 193 deletions(-)
fs/xfs/linux-2.6/xfs_trace.h +0 -2
@@ -653,8 +653,6 @@ DEFINE_EVENT(xfs_dquot_class, name, \ TP_PROTO(struct xfs_dquot *dqp), \ TP_ARGS(dqp)) DEFINE_DQUOT_EVENT(xfs_dqadjust); -DEFINE_DQUOT_EVENT(xfs_dqshake_dirty); -DEFINE_DQUOT_EVENT(xfs_dqshake_unlink); DEFINE_DQUOT_EVENT(xfs_dqreclaim_want); DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty); DEFINE_DQUOT_EVENT(xfs_dqreclaim_unlink);
fs/xfs/quota/xfs_qm.c +78 -191
369 lines not on this page · raw message
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 6/8] xfs: remove duplicate code from dquot reclaim
Quoted 8 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The dquot shaker and the free-list reclaim code use exactly the same algorithm but the code is duplicated and slightly different in each case. Make the shaker code use the single dquot reclaim code to remove the code duplication.
Signed-off-by Dave Chinner <[email protected]>
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 7/8 xfs: convert the dquot hash list to use list heads
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Convert the dquot hash list on the filesystem to use listhead infrastructure rather than the roll-your-own in the quota code.
--- fs/xfs/linux-2.6/xfs_trace.h | 1 - fs/xfs/quota/xfs_dquot.c | 32 ++++++++++---------------------- fs/xfs/quota/xfs_dquot.h | 9 ++------- fs/xfs/quota/xfs_qm.c | 9 +++++---- fs/xfs/quota/xfs_qm_syscalls.c | 34 +++++++++++++--------------------- fs/xfs/quota/xfs_quota_priv.h | 33 --------------------------------- 6 files changed, 30 insertions(+), 88 deletions(-)
fs/xfs/linux-2.6/xfs_trace.h +0 -1
@@ -667,7 +667,6 @@ DEFINE_DQUOT_EVENT(xfs_dqread_fail);DEFINE_DQUOT_EVENT (xfs_dqlookup_found);DEFINE_DQUOT_EVENT (xfs_dqlookup_want);DEFINE_DQUOT_EVENT (xfs_dqlookup_freelist); -DEFINE_DQUOT_EVENT (xfs_dqlookup_move);DEFINE_DQUOT_EVENT (xfs_dqlookup_done);DEFINE_DQUOT_EVENT (xfs_dqget_hit);DEFINE_DQUOT_EVENT (xfs_dqget_miss);
fs/xfs/quota/xfs_dquot.c +10 -22
@@ -122,8 +122,7 @@ xfs_qm_dqinit( dqp->q_nrefs =0 ; dqp->q_blkno =0 ;INIT_LIST_HEAD (&dqp->q_mplist); - dqp->HL_NEXT =NULL ; - dqp->HL_PREVP =NULL ; +INIT_LIST_HEAD (&dqp->q_hashlist); dqp->q_bufoffset =0 ; dqp->q_fileoffset =0 ; dqp->q_transp =NULL ;
@@ -752,7 +751,6 @@ xfs_qm_dqlookup( {xfs_dquot_t *dqp;uint flist_locked; -xfs_dquot_t *d;ASSERT (mutex_is_locked (&qh->qh_lock));
@@ -761,7 +759,7 @@ xfs_qm_dqlookup(/* * Traverse the hashchain looking for a match */ -for (dqp = qh->qh_next; dqp !=NULL ; dqp = dqp->HL_NEXT) { +list_for_each_entry (dqp, &qh->qh_list, q_hashlist) {/* * We already have the hashlock. We don't need the * dqlock to look at the id field of the dquot, since the
@@ -828,21 +826,10 @@ xfs_qm_dqlookup(* move the dquot to the front of the hashchain */ ASSERT (mutex_is_locked (&qh->qh_lock)); -if (dqp->HL_PREVP != &qh->qh_next) { -trace_xfs_dqlookup_move (dqp); -if ((d = dqp->HL_NEXT)) - d->HL_PREVP = dqp->HL_PREVP; - *(dqp->HL_PREVP) = d; - d = qh->qh_next; - d->HL_PREVP = &dqp->HL_NEXT; - dqp->HL_NEXT = d; - dqp->HL_PREVP = &qh->qh_next; - qh->qh_next = dqp; - } +list_move (&dqp->q_hashlist, &qh->qh_list);trace_xfs_dqlookup_done (dqp); *O_dqpp = dqp; -ASSERT (mutex_is_locked (&qh->qh_lock)); -return (0 ); +return 0 ; } }
@@ -1034,7 +1021,8 @@ xfs_qm_dqget(*/ ASSERT (mutex_is_locked (&h->qh_lock)); dqp->q_hash = h; -XQM_HASHLIST_INSERT (h, dqp); +list_add (&dqp->q_hashlist, &h->qh_list); + h->qh_version++;/* * Attach this dquot to this filesystem's list of all dquots,
@@ -1387,7 +1375,7 @@ intxfs_qm_dqpurge ( xfs_dquot_t *dqp) { -xfs_dqhash_t *thishash; +xfs_dqhash_t *qh = dqp->q_hash;xfs_mount_t *mp = dqp->q_mount;ASSERT (mutex_is_locked (&mp->m_quotainfo->qi_dqlist_lock));
@@ -1453,8 +1441,8 @@ xfs_qm_dqpurge(ASSERT (XFS_FORCED_SHUTDOWN (mp) || !(dqp->q_logitem.qli_item.li_flags &XFS_LI_IN_AIL )); - thishash = dqp->q_hash; -XQM_HASHLIST_REMOVE (thishash, dqp); +list_del_init (&dqp->q_hashlist); + qh->qh_version++;list_del_init (&dqp->q_mplist); mp->m_quotainfo->qi_dqreclaims++; mp->m_quotainfo->qi_dquots--;
@@ -1470,7 +1458,7 @@ xfs_qm_dqpurge(memset (&dqp->q_core,0 ,sizeof (dqp->q_core));xfs_dqfunlock (dqp);xfs_dqunlock (dqp); -mutex_unlock (&thishash->qh_lock); +mutex_unlock (&qh->qh_lock);return (0 ); }
fs/xfs/quota/xfs_dquot.h +2 -7
@@ -33,17 +33,12 @@* The hash chain headers (hash buckets) */ typedef struct xfs_dqhash { -struct xfs_dquot *qh_next; +struct list_head qh_list;struct mutex qh_lock;uint qh_version;/* ever increasing version */ uint qh_nelems;/* number of dquots on the list */ }xfs_dqhash_t ; -typedef struct xfs_dqlink { -struct xfs_dquot *ql_next;/* forward link */ -struct xfs_dquot **ql_prevp;/* pointer to prev ql_next */ -}xfs_dqlink_t ; -struct xfs_mount ;struct xfs_trans ;
@@ -57,7 +52,6 @@ struct xfs_trans;typedef struct xfs_dqmarker {struct xfs_dquot *dqm_flnext;/* link to freelist: must be first */ struct xfs_dquot *dqm_flprev; -xfs_dqlink_t dqm_hashlist;/* link to the hash chain */ uint dqm_flags;/* various flags (XFS_DQ_*) */ }xfs_dqmarker_t ;
@@ -67,6 +61,7 @@ typedef struct xfs_dqmarker { typedef struct xfs_dquot { xfs_dqmarker_t q_lists; /* list ptrs, q_flags (marker) */ struct list_head q_mplist; /* mount's list of dquots */ + struct list_head q_hashlist; /* mount's list of dquots */ xfs_dqhash_t *q_hash; /* the hashchain header */ struct xfs_mount*q_mount; /* filesystem this relates to */ struct xfs_trans*q_transp; /* trans this belongs to currently */
fs/xfs/quota/xfs_qm.c +5 -4
@@ -277,7 +277,7 @@ xfs_qm_rele_quotafs_ref(if (dqp->dq_flags &XFS_DQ_INACTIVE ) {ASSERT (dqp->q_mount ==NULL );ASSERT (!XFS_DQ_IS_DIRTY (dqp)); -ASSERT (dqp->HL_PREVP ==NULL ); +ASSERT (list_empty (&dqp->q_hashlist));ASSERT (list_empty (&dqp->q_mplist));XQM_FREELIST_REMOVE (dqp);xfs_dqunlock (dqp);
@@ -1176,7 +1176,7 @@ xfs_qm_list_init( int n) {mutex_init (&list->qh_lock); - list->qh_next =NULL ; +INIT_LIST_HEAD (&list->qh_list); list->qh_version =0 ; list->qh_nelems =0 ; }
@@ -1976,7 +1976,7 @@ startagain:if (dqp->dq_flags &XFS_DQ_INACTIVE ) {ASSERT (mp ==NULL );ASSERT (!XFS_DQ_IS_DIRTY (dqp)); -ASSERT (dqp->HL_PREVP ==NULL ); +ASSERT (list_empty (&dqp->q_hashlist));ASSERT (list_empty (&dqp->q_mplist));XQM_FREELIST_REMOVE (dqp);xfs_dqunlock (dqp);
@@ -2055,7 +2055,8 @@ startagain:list_del_init (&dqp->q_mplist); mp->m_quotainfo->qi_dquots--; mp->m_quotainfo->qi_dqreclaims++; -XQM_HASHLIST_REMOVE (dqp->q_hash, dqp); +list_del_init (&dqp->q_hashlist); + dqp->q_hash->qh_version++;XQM_FREELIST_REMOVE (dqp); dqpout = dqp;mutex_unlock (&mp->m_quotainfo->qi_dqlist_lock);
fs/xfs/quota/xfs_qm_syscalls.c +13 -21
@@ -931,6 +931,7 @@ struct mutex qcheck_lock; typedef struct dqtest { xfs_dqmarker_t q_lists; + struct list_head q_hashlist; xfs_dqhash_t *q_hash; /* the hashchain header */ xfs_mount_t *q_mount; /* filesystem this relates to */ xfs_dqid_t d_id; /* user id or group id */
@@ -941,14 +942,9 @@ typedef struct dqtest { STATIC voidxfs_qm_hashinsert (xfs_dqhash_t *h,xfs_dqtest_t *dqp) { -xfs_dquot_t *d; -if (((d) = (h)->qh_next)) - (d)->HL_PREVP = &((dqp)->HL_NEXT); - (dqp)->HL_NEXT = d; - (dqp)->HL_PREVP = &((h)->qh_next); - (h)->qh_next = (xfs_dquot_t *)dqp; - (h)->qh_version++; - (h)->qh_nelems++; +list_add (&dqp->q_hashlist, &h->qh_list); + h->qh_version++; + h->qh_nelems++; } STATIC void xfs_qm_dqtest_print(
@@ -1060,9 +1056,7 @@ xfs_qm_internalqcheck_dqget(xfs_dqhash_t *h; h =DQTEST_HASH (mp, id, type); -for (d = (xfs_dqtest_t *) h->qh_next; d !=NULL ; - d = (xfs_dqtest_t *) d->HL_NEXT) { -/* DQTEST_LIST_PRINT(h, HL_NEXT, "@@@@@ dqtestlist @@@@@"); */ +list_for_each_entry (d, &h->qh_list, q_hashlist) {if (d->d_id == id && mp == d->q_mount) { *O_dq = d;return (0 );
@@ -1073,6 +1067,7 @@ xfs_qm_internalqcheck_dqget( d->d_id = id; d->q_mount = mp; d->q_hash = h; +INIT_LIST_HEAD (&d->q_hashlist);xfs_qm_hashinsert (h, d); *O_dq = d;return (0 );
@@ -1179,8 +1174,6 @@ xfs_qm_internalqcheck(xfs_ino_t lastino;int done, count;int i; -xfs_dqtest_t *d, *e; -xfs_dqhash_t *h1;int error; lastino =0 ;
@@ -1220,19 +1213,18 @@ xfs_qm_internalqcheck( }cmn_err (CE_DEBUG ,"Checking results against system dquots" );for (i =0 ; i < qmtest_hashmask; i++) { - h1 = &qmtest_udqtab[i]; -for (d = (xfs_dqtest_t *) h1->qh_next; d !=NULL ; ) { +xfs_dqtest_t *d, *n; +xfs_dqhash_t *h; + + h = &qmtest_udqtab[i]; +list_for_each_entry_safe (d, n, &h->qh_list, q_hashlist) {xfs_dqtest_cmp (d); - e = (xfs_dqtest_t *) d->HL_NEXT;kmem_free (d); - d = e; } - h1 = &qmtest_gdqtab[i]; -for (d = (xfs_dqtest_t *) h1->qh_next; d !=NULL ; ) { + h = &qmtest_gdqtab[i]; +list_for_each_entry_safe (d, n, &h->qh_list, q_hashlist) {xfs_dqtest_cmp (d); - e = (xfs_dqtest_t *) d->HL_NEXT;kmem_free (d); - d = e; } }
fs/xfs/quota/xfs_quota_priv.h +0 -33
@@ -72,46 +72,13 @@ !dqp->q_core.d_rtbcount && \ !dqp->q_core.d_icount) -#define HL_PREVP dq_hashlist.ql_prevp -#define HL_NEXT dq_hashlist.ql_next - - -#define _LIST_REMOVE (h, dqp,PVP ,NXT ) \ - { \ - xfs_dquot_t *d; \ - if (((d) = (dqp)->NXT)) \ - (d)->PVP = (dqp)->PVP; \ - *((dqp)->PVP) = d; \ - (dqp)->NXT = NULL; \ - (dqp)->PVP = NULL; \ - (h)->qh_version++; \ - (h)->qh_nelems--; \ - } - -#define _LIST_INSERT (h, dqp,PVP ,NXT ) \ - { \ - xfs_dquot_t *d; \ - if (((d) = (h)->qh_next)) \ - (d)->PVP = &((dqp)->NXT); \ - (dqp)->NXT = d; \ - (dqp)->PVP = &((h)->qh_next); \ - (h)->qh_next = dqp; \ - (h)->qh_version++; \ - (h)->qh_nelems++; \ - } -#define FOREACH_DQUOT_IN_FREELIST (dqp, qlist) \ for ((dqp) = (qlist)->qh_next; (dqp) != (xfs_dquot_t *)(qlist); \ (dqp) = (dqp)->dq_flnext) -#define XQM_HASHLIST_INSERT (h, dqp) \ - _LIST_INSERT(h, dqp, HL_PREVP, HL_NEXT) -#define XQM_FREELIST_INSERT (h, dqp) \ xfs_qm_freelist_append(h, dqp) -#define XQM_HASHLIST_REMOVE (h, dqp) \ - _LIST_REMOVE(h, dqp, HL_PREVP, HL_NEXT)#define XQM_FREELIST_REMOVE (dqp) \ xfs_qm_freelist_unlink(dqp)
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 7/8] xfs: convert the dquot hash list to use list heads
Quoted 6 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Convert the dquot hash list on the filesystem to use listhead infrastructure rather than the roll-your-own in the quota code.
Signed-off-by Dave Chinner <[email protected]>
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 8/8 xfs: convert the dquot free list to use list heads
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Convert the dquot free list on the filesystem to use listhead infrastructure rather than the roll-your-own in the quota code.
--- fs/xfs/quota/xfs_dquot.c | 75 +++++++++++--------------- fs/xfs/quota/xfs_dquot.h | 5 +- fs/xfs/quota/xfs_qm.c | 119 ++++++++++++----------------------------- fs/xfs/quota/xfs_qm.h | 19 +------ fs/xfs/quota/xfs_qm_stats.c | 2 +- fs/xfs/quota/xfs_quota_priv.h | 17 ------ 6 files changed, 72 insertions(+), 165 deletions(-)
fs/xfs/quota/xfs_dquot.c +31 -44
@@ -101,7 +101,7 @@ xfs_qm_dqinit(* No need to re-initialize these if this is a reclaimed dquot. */ if (brandnewdquot) { - dqp->dq_flnext = dqp->dq_flprev = dqp; +INIT_LIST_HEAD (&dqp->q_freelist);mutex_init (&dqp->q_qlock);init_waitqueue_head (&dqp->q_pinwait);
@@ -119,20 +119,20 @@ xfs_qm_dqinit(* Only the q_core portion was zeroed in dqreclaim_one(). * So, we need to reset others. */ - dqp->q_nrefs =0 ; - dqp->q_blkno =0 ; -INIT_LIST_HEAD (&dqp->q_mplist); -INIT_LIST_HEAD (&dqp->q_hashlist); - dqp->q_bufoffset =0 ; - dqp->q_fileoffset =0 ; - dqp->q_transp =NULL ; - dqp->q_gdquot =NULL ; - dqp->q_res_bcount =0 ; - dqp->q_res_icount =0 ; - dqp->q_res_rtbcount =0 ; -atomic_set (&dqp->q_pincount,0 ); - dqp->q_hash =NULL ; -ASSERT (dqp->dq_flnext == dqp->dq_flprev); + dqp->q_nrefs =0 ; + dqp->q_blkno =0 ; +INIT_LIST_HEAD (&dqp->q_mplist); +INIT_LIST_HEAD (&dqp->q_hashlist); + dqp->q_bufoffset =0 ; + dqp->q_fileoffset =0 ; + dqp->q_transp =NULL ; + dqp->q_gdquot =NULL ; + dqp->q_res_bcount =0 ; + dqp->q_res_icount =0 ; + dqp->q_res_rtbcount =0 ; +atomic_set (&dqp->q_pincount,0 ); + dqp->q_hash =NULL ; +ASSERT (list_empty (&dqp->q_freelist));trace_xfs_dqreuse (dqp); }
@@ -158,7 +158,7 @@ voidxfs_qm_dqdestroy ( xfs_dquot_t *dqp) { -ASSERT (!XFS_DQ_IS_ON_FREELIST (dqp)); +ASSERT (list_empty (&dqp->q_freelist));mutex_destroy (&dqp->q_qlock);sv_destroy (&dqp->q_pinwait);
@@ -775,8 +775,8 @@ xfs_qm_dqlookup(xfs_dqlock (dqp);if (dqp->q_nrefs ==0 ) { -ASSERT (XFS_DQ_IS_ON_FREELIST (dqp)); -if (!xfs_qm_freelist_lock_nowait (xfs_Gqm)) { +ASSERT (!list_empty (&dqp->q_freelist)); +if (!mutex_trylock (&xfs_Gqm->qm_dqfrlist_lock)) {trace_xfs_dqlookup_want (dqp);/*
@@ -786,7 +786,7 @@ xfs_qm_dqlookup(*/ dqp->dq_flags |=XFS_DQ_WANT ;xfs_dqunlock (dqp); -xfs_qm_freelist_lock (xfs_Gqm); +mutex_lock (&xfs_Gqm->qm_dqfrlist_lock);xfs_dqlock (dqp); dqp->dq_flags &= ~(XFS_DQ_WANT ); }
@@ -801,27 +801,20 @@ xfs_qm_dqlookup(if (flist_locked) {if (dqp->q_nrefs !=0 ) { -xfs_qm_freelist_unlock (xfs_Gqm); +mutex_unlock (&xfs_Gqm->qm_dqfrlist_lock); flist_locked =B_FALSE ; }else { -/* -* take it off the freelist -*/ +/* take it off the freelist */ trace_xfs_dqlookup_freelist (dqp); -XQM_FREELIST_REMOVE (dqp); -/* xfs_qm_freelist_print(&(xfs_Gqm-> -qm_dqfreelist), -"after removal"); */ +list_del_init (&dqp->q_freelist); + xfs_Gqm->qm_dqfrlist_cnt--; } } -/* -* grab a reference -*/ XFS_DQHOLD (dqp);if (flist_locked) -xfs_qm_freelist_unlock (xfs_Gqm); +mutex_unlock (&xfs_Gqm->qm_dqfrlist_lock);/* * move the dquot to the front of the hashchain */
@@ -1075,10 +1068,10 @@ xfs_qm_dqput(* drop the dqlock and acquire the freelist and dqlock * in the right order; but try to get it out-of-order first */ -if (!xfs_qm_freelist_lock_nowait (xfs_Gqm)) { +if (!mutex_trylock (&xfs_Gqm->qm_dqfrlist_lock)) {trace_xfs_dqput_wait (dqp);xfs_dqunlock (dqp); -xfs_qm_freelist_lock (xfs_Gqm); +mutex_lock (&xfs_Gqm->qm_dqfrlist_lock);xfs_dqlock (dqp); }
@@ -1089,10 +1082,8 @@ xfs_qm_dqput(if (--dqp->q_nrefs ==0 ) {trace_xfs_dqput_free (dqp); -/* -* insert at end of the freelist. -*/ -XQM_FREELIST_INSERT (&(xfs_Gqm->qm_dqfreelist), dqp); +list_add_tail (&dqp->q_freelist, &xfs_Gqm->qm_dqfrlist); + xfs_Gqm->qm_dqfrlist_cnt++;/* * If we just added a udquot to the freelist, then
@@ -1107,10 +1098,6 @@ xfs_qm_dqput(xfs_dqlock (gdqp); dqp->q_gdquot =NULL ; } - -/* xfs_qm_freelist_print(&(xfs_Gqm->qm_dqfreelist), -"@@@@@++ Free list (after append) @@@@@+"); -*/ }xfs_dqunlock (dqp);
@@ -1122,7 +1109,7 @@ xfs_qm_dqput(break ; dqp = gdqp; } -xfs_qm_freelist_unlock (xfs_Gqm); +mutex_unlock (&xfs_Gqm->qm_dqfrlist_lock); }/*
@@ -1396,7 +1383,7 @@ xfs_qm_dqpurge(return (1 ); } -ASSERT (XFS_DQ_IS_ON_FREELIST (dqp)); +ASSERT (!list_empty (&dqp->q_freelist));/* * If we're turning off quotas, we have to make sure that, for
@@ -1450,7 +1437,7 @@ xfs_qm_dqpurge(* XXX Move this to the front of the freelist, if we can get the * freelist lock. */ -ASSERT (XFS_DQ_IS_ON_FREELIST (dqp)); +ASSERT (!list_empty (&dqp->q_freelist)); dqp->q_mount =NULL ; dqp->q_hash =NULL ;
fs/xfs/quota/xfs_dquot.h +2 -3
@@ -50,8 +50,6 @@ struct xfs_trans;* iterations because of locking considerations. */ typedef struct xfs_dqmarker { -struct xfs_dquot *dqm_flnext;/* link to freelist: must be first */ -struct xfs_dquot *dqm_flprev;uint dqm_flags;/* various flags (XFS_DQ_*) */ }xfs_dqmarker_t ;
@@ -60,8 +58,9 @@ typedef struct xfs_dqmarker {*/ typedef struct xfs_dquot { xfs_dqmarker_t q_lists; /* list ptrs, q_flags (marker) */ + struct list_head q_freelist; /* global free list of dquots */ struct list_head q_mplist; /* mount's list of dquots */ - struct list_head q_hashlist; /* mount's list of dquots */ + struct list_head q_hashlist; /* gloabl hash list of dquots */ xfs_dqhash_t *q_hash; /* the hashchain header */ struct xfs_mount*q_mount; /* filesystem this relates to */ struct xfs_trans*q_transp; /* trans this belongs to currently */
fs/xfs/quota/xfs_qm.c +35 -84
214 lines not on this page · raw message
fs/xfs/quota/xfs_qm.h +3 -16
@@ -72,17 +72,6 @@ extern kmem_zone_t *qm_dqtrxzone;#define XFS_QM_MAX_DQCLUSTER_LOGSZ 3typedef xfs_dqhash_t xfs_dqlist_t ; -/* -* The freelist head. The first two fields match the first two in the -* xfs_dquot_t structure (in xfs_dqmarker_t) -*/ -typedef struct xfs_frlist { -struct xfs_dquot *qh_next; -struct xfs_dquot *qh_prev; -struct mutex qh_lock; -uint qh_version; -uint qh_nelems; -}xfs_frlist_t ;/* * Quota Manager (global) structure. Lives only in core.
@@ -91,7 +80,9 @@ typedef struct xfs_qm {xfs_dqlist_t *qm_usr_dqhtable;/* udquot hash table */ xfs_dqlist_t *qm_grp_dqhtable;/* gdquot hash table */ uint qm_dqhashmask;/* # buckets in dq hashtab - 1 */ -xfs_frlist_t qm_dqfreelist;/* freelist of dquots */ +struct list_head qm_dqfrlist;/* freelist of dquots */ +struct mutex qm_dqfrlist_lock; +int qm_dqfrlist_cnt;atomic_t qm_totaldquots;/* total incore dquots */ uint qm_nrefs;/* file systems with quota on */ int qm_dqfree_ratio;/* ratio of free to inuse dquots */
@@ -177,10 +168,6 @@ extern int xfs_qm_scall_getqstat(xfs_mount_t *, fs_quota_stat_t *);extern int xfs_qm_scall_quotaon (xfs_mount_t *,uint );extern int xfs_qm_scall_quotaoff (xfs_mount_t *,uint ); -/* list stuff */ -extern void xfs_qm_freelist_append (xfs_frlist_t *,xfs_dquot_t *); -extern void xfs_qm_freelist_unlink (xfs_dquot_t *); -#ifdef DEBUG extern int xfs_qm_internalqcheck (xfs_mount_t *);#else
fs/xfs/quota/xfs_qm_stats.c +1 -1
@@ -55,7 +55,7 @@ static int xqm_proc_show(struct seq_file *m, void *v) ndquot, xfs_Gqm?atomic_read (&xfs_Gqm->qm_totaldquots) :0 , xfs_Gqm? xfs_Gqm->qm_dqfree_ratio :0 , - xfs_Gqm? xfs_Gqm->qm_dqfreelist.qh_nelems : 0); + xfs_Gqm? xfs_Gqm->qm_dqfrlist_cnt : 0);return 0 ; }
fs/xfs/quota/xfs_quota_priv.h +0 -17
@@ -40,13 +40,6 @@#define XFS_QI_IWARNLIMIT (mp) ((mp)->m_quotainfo->qi_iwarnlimit)#define XFS_QI_QOFFLOCK (mp) ((mp)->m_quotainfo->qi_quotaofflock) -#define xfs_qm_freelist_lock (qm) \ - mutex_lock(&((qm)->qm_dqfreelist.qh_lock)) -#define xfs_qm_freelist_lock_nowait (qm) \ - mutex_trylock(&((qm)->qm_dqfreelist.qh_lock)) -#define xfs_qm_freelist_unlock (qm) \ - mutex_unlock(&((qm)->qm_dqfreelist.qh_lock)) -/* * Hash into a bucket in the dquot hash table, based on <mp, id>. */
@@ -72,16 +65,6 @@ !dqp->q_core.d_rtbcount && \ !dqp->q_core.d_icount) -#define FOREACH_DQUOT_IN_FREELIST (dqp, qlist) \ -for ((dqp) = (qlist)->qh_next; (dqp) != (xfs_dquot_t *)(qlist); \ - (dqp) = (dqp)->dq_flnext) - -#define XQM_FREELIST_INSERT (h, dqp) \ - xfs_qm_freelist_append(h, dqp) - -#define XQM_FREELIST_REMOVE (dqp) \ - xfs_qm_freelist_unlink(dqp) -#define XFS_DQ_IS_LOGITEM_INITD (dqp) ((dqp)->q_logitem.qli_dquot == (dqp))#define XFS_QM_DQP_TO_DQACCT (tp, dqp) (XFS_QM_ISUDQ(dqp) ? \
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 8/8] xfs: convert the dquot free list to use list heads
Quoted 6 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Convert the dquot free list on the filesystem to use listhead infrastructure rather than the roll-your-own in the quota code.
Signed-off-by Dave Chinner <[email protected]>
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
[PATCH 9/8] xfs: remove xfs_dqmarker
In reply to Dave Chinnerfs/xfs/quota/xfs_dquot.h +1 -20
@@ -43,21 +43,10 @@ struct xfs_mount;struct xfs_trans ;/* -* This is the marker which is designed to occupy the first few -* bytes of the xfs_dquot_t structure. Even inside this, the freelist pointers -* must come first. -* This serves as the marker ("sentinel") when we have to restart list -* iterations because of locking considerations. -*/ -typedef struct xfs_dqmarker { -uint dqm_flags;/* various flags (XFS_DQ_*) */ -}xfs_dqmarker_t ; - -/* * The incore dquot structure */ typedef struct xfs_dquot { - xfs_dqmarker_t q_lists; /* list ptrs, q_flags (marker) */ + uint dq_flags; /* various flags (XFS_DQ_*) */ struct list_head q_freelist; /* global free list of dquots */ struct list_head q_mplist; /* mount's list of dquots */ struct list_head q_hashlist; /* gloabl hash list of dquots */
@@ -81,13 +70,6 @@ typedef struct xfs_dquot {wait_queue_head_t q_pinwait;/* dquot pinning wait queue */ } xfs_dquot_t; - -#define dq_flnext q_lists.dqm_flnext -#define dq_flprev q_lists.dqm_flprev -#define dq_mplist q_lists.dqm_mplist -#define dq_hashlist q_lists.dqm_hashlist -#define dq_flags q_lists.dqm_flags -/* * Lock hierarchy for q_qlock: * XFS_QLOCK_NORMAL is the implicit default,
@@ -121,7 +103,6 @@ static inline void xfs_dqfunlock(xfs_dqu }#define XFS_DQ_IS_LOCKED (dqp) (mutex_is_locked(&((dqp)->q_qlock))) -#define XFS_DQ_IS_ON_FREELIST (dqp) ((dqp)->dq_flnext != (dqp))#define XFS_DQ_IS_DIRTY (dqp) ((dqp)->dq_flags & XFS_DQ_DIRTY)#define XFS_QM_ISUDQ (dqp) ((dqp)->dq_flags & XFS_DQ_USER)#define XFS_QM_ISPDQ (dqp) ((dqp)->dq_flags & XFS_DQ_PROJ)
fs/xfs/quota/xfs_qm_syscalls.c +1 -1
@@ -930,7 +930,7 @@ struct mutex qcheck_lock; } typedef struct dqtest { - xfs_dqmarker_t q_lists; + uint dq_flags; /* various flags (XFS_DQ_*) */ struct list_head q_hashlist; xfs_dqhash_t *q_hash; /* the hashchain header */ xfs_mount_t *q_mount; /* filesystem this relates to */
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 9/8] xfs: remove xfs_dqmarker
Quoted 1 line · Christoph Hellwig
Signed-off-by Christoph Hellwig <[email protected]>
Looks good. I hadn't done this one yet, I'll add it to the series...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs