xfs: current 3.4 patch queue
PATCH 1/37 xfs: remove log item from AIL in xfs_qm_dqflush after a shutdown
In reply to Dave ChinnerFrom: Christoph Hellwig <[email protected]>
If a filesystem has been forced shutdown we are never going to write dquots to disk, which means the dquot items will stay in the AIL forever. Currently that is not a problem, but a pending chance requires us to empty the AIL before shutting down the filesystem, in which case this behaviour is lethal. Make sure to remove the log item from the AIL to allow emptying the AIL on shutdown filesystems.
--- fs/xfs/xfs_dquot.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
fs/xfs/xfs_dquot.c +13 -1
@@ -904,10 +904,22 @@ xfs_qm_dqflush(/* * This may have been unpinned because the filesystem is shutting * down forcibly. If that's the case we must not write this dquot -* to disk, because the log record didn't make it to disk! +* to disk, because the log record didn't make it to disk. +* +* We also have to remove the log item from the AIL in this case, +* as we wait for an emptry AIL as part of the unmount process. */ if (XFS_FORCED_SHUTDOWN (mp)) { +struct xfs_log_item *lip = &dqp->q_logitem.qli_item; dqp->dq_flags &= ~XFS_DQ_DIRTY ; + +spin_lock (&mp->m_ail->xa_lock); +if (lip->li_flags &XFS_LI_IN_AIL ) +xfs_trans_ail_delete (mp->m_ail, lip, +SHUTDOWN_CORRUPT_INCORE ); +else +spin_unlock (&mp->m_ail->xa_lock); +xfs_dqfunlock (dqp);return XFS_ERROR (EIO ); }
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 7/37 xfs: do not write the buffer from xfs_qm_dqflush
In reply to Dave ChinnerFrom: Christoph Hellwig <[email protected]>
Instead of writing the buffer directly from inside xfs_qm_dqflush return it to the caller and let the caller decide what to do with the buffer. Also remove the pincount check in xfs_qm_dqflush that all non-blocking callers already implement and the now unused flags parameter and the XFS_DQ_IS_DIRTY check that all callers already perform.
[ Dave Chinner: fixed build error cause by missing '{'. ]
--- fs/xfs/xfs_dquot.c | 43 +++++++++++++------------------------------ fs/xfs/xfs_dquot.h | 2 +- fs/xfs/xfs_dquot_item.c | 21 +++++++++++++++++++-- fs/xfs/xfs_qm.c | 25 ++++++++++++++++++++----- 4 files changed, 53 insertions(+), 38 deletions(-)
fs/xfs/xfs_dquot.c +13 -30
@@ -878,8 +878,8 @@ xfs_qm_dqflush_done(*/ int xfs_qm_dqflush ( -xfs_dquot_t *dqp, -uint flags) +struct xfs_dquot *dqp, +struct xfs_buf **bpp) {struct xfs_mount *mp = dqp->q_mount;struct xfs_buf *bp;
@@ -891,14 +891,8 @@ xfs_qm_dqflush(trace_xfs_dqflush (dqp); -/* -* If not dirty, or it's pinned and we are not supposed to block, nada. -*/ -if (!XFS_DQ_IS_DIRTY (dqp) || - ((flags &SYNC_TRYLOCK ) &&atomic_read (&dqp->q_pincount) >0 )) { -xfs_dqfunlock (dqp); -return 0 ; - } + *bpp =NULL ; +xfs_qm_dqunpin_wait (dqp);/*
@@ -918,9 +912,8 @@ xfs_qm_dqflush(xfs_trans_ail_delete (mp->m_ail, lip); else spin_unlock(&mp->m_ail->xa_lock); - -xfs_dqfunlock (dqp); -return XFS_ERROR (EIO ); + error =XFS_ERROR (EIO ); + goto out_unlock; }/*
@@ -928,11 +921,8 @@ xfs_qm_dqflush(*/ error =xfs_trans_read_buf (mp,NULL , mp->m_ddev_targp, dqp->q_blkno, mp->m_quotainfo->qi_dqchunklen,0 , &bp); -if (error) { -ASSERT (error !=ENOENT ); -xfs_dqfunlock (dqp); -return error; - } +if (error) + goto out_unlock;/* * Calculate the location of the dquot inside the buffer.
@@ -978,20 +968,13 @@ xfs_qm_dqflush(xfs_log_force (mp,0 ); } -if (flags &SYNC_WAIT ) - error =xfs_bwrite (bp); -else -xfs_buf_delwri_queue (bp); - -xfs_buf_relse (bp); -trace_xfs_dqflush_done (dqp); + *bpp = bp; +return 0 ; -/* -* dqp is still locked, but caller is free to unlock it now. -*/ -return error; - +out_unlock: +xfs_dqfunlock (dqp); +return XFS_ERROR (EIO ); }/*
fs/xfs/xfs_dquot.h +1 -1
@@ -141,7 +141,7 @@ static inline xfs_dquot_t *xfs_inode_dquot(struct xfs_inode *ip, int type)extern int xfs_qm_dqread (struct xfs_mount *,xfs_dqid_t ,uint ,uint ,struct xfs_dquot **);extern void xfs_qm_dqdestroy (xfs_dquot_t *); -extern int xfs_qm_dqflush (xfs_dquot_t *,uint ); +extern int xfs_qm_dqflush (struct xfs_dquot *,struct xfs_buf **);extern void xfs_qm_dqunpin_wait (xfs_dquot_t *);extern void xfs_qm_adjust_dqtimers (xfs_mount_t *,xfs_disk_dquot_t *);
fs/xfs/xfs_dquot_item.c +19 -2
@@ -119,10 +119,12 @@ xfs_qm_dquot_logitem_push( struct xfs_log_item *lip) {struct xfs_dquot *dqp =DQUOT_ITEM (lip)->qli_dquot; +struct xfs_buf *bp =NULL ;int error;ASSERT (XFS_DQ_IS_LOCKED (dqp));ASSERT (!completion_done (&dqp->q_flush)); +ASSERT (atomic_read (&dqp->q_pincount) ==0 );/* * Since we were able to lock the dquot's flush lock and
@@ -133,10 +135,16 @@ xfs_qm_dquot_logitem_push(* lock without sleeping, then there must not have been * anyone in the process of flushing the dquot. */ - error =xfs_qm_dqflush (dqp,SYNC_TRYLOCK ); -if (error) + error =xfs_qm_dqflush (dqp, &bp); +if (error) {xfs_warn (dqp->q_mount,"%s: push error %d on dqp %p" , __func__, error, dqp); + goto out_unlock; + } + +xfs_buf_delwri_queue (bp); +xfs_buf_relse (bp); +out_unlock:xfs_dqunlock (dqp); }
@@ -239,6 +247,15 @@ xfs_qm_dquot_logitem_trylock(if (!xfs_dqlock_nowait (dqp))return XFS_ITEM_LOCKED ; +/* +* Re-check the pincount now that we stabilized the value by +* taking the quota lock. +*/ +if (atomic_read (&dqp->q_pincount) >0 ) { +xfs_dqunlock (dqp); +return XFS_ITEM_PINNED ; + } +if (!xfs_dqflock_nowait (dqp)) {/* * dquot has already been flushed to the backing buffer,
fs/xfs/xfs_qm.c +20 -5
@@ -175,16 +175,21 @@ xfs_qm_dqpurge(* we're unmounting, we do care, so we flush it and wait. */ if (XFS_DQ_IS_DIRTY (dqp)) { -int error; +struct xfs_buf *bp =NULL ; +int error;/* * We don't care about getting disk errors here. We need * to purge this dquot anyway, so we go ahead regardless. */ - error =xfs_qm_dqflush (dqp,SYNC_WAIT ); -if (error) + error =xfs_qm_dqflush (dqp, &bp); +if (error) {xfs_warn (mp,"%s: dquot %p flush failed" , __func__, dqp); + }else { + error =xfs_bwrite (bp); +xfs_buf_relse (bp); + }xfs_dqflock (dqp); }
@@ -1200,6 +1205,7 @@ STATIC intxfs_qm_flush_one ( struct xfs_dquot *dqp) { +struct xfs_buf *bp =NULL ;int error =0 ;xfs_dqlock (dqp);
@@ -1211,8 +1217,12 @@ xfs_qm_flush_one(if (!xfs_dqflock_nowait (dqp))xfs_dqflock_pushbuf_wait (dqp); - error =xfs_qm_dqflush (dqp,0 ); + error =xfs_qm_dqflush (dqp, &bp); +if (error) + goto out_unlock; +xfs_buf_delwri_queue (bp); +xfs_buf_relse (bp); out_unlock:xfs_dqunlock (dqp);return error;
@@ -1479,18 +1489,23 @@ xfs_qm_dqreclaim_one(* dirty dquots. */ if (XFS_DQ_IS_DIRTY (dqp)) { +struct xfs_buf *bp =NULL ; +trace_xfs_dqreclaim_dirty (dqp);/* * We flush it delayed write, so don't bother releasing the * freelist lock. */ - error =xfs_qm_dqflush (dqp,0 ); + error =xfs_qm_dqflush (dqp, &bp);if (error) {xfs_warn (mp,"%s: dquot %p flush failed" , __func__, dqp); + goto out_busy; } +xfs_buf_delwri_queue (bp); +xfs_buf_relse (bp);/* * Give the dquot another try on the freelist, as the * flushing will take some time.
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
cover xfs: current 3.4 patch queue
Folks,
This is my current patch queue that I'm testing. It's sitting on top of Jan Kara's freeze series, but otherwise it is based on an unmodified 3.4-rc4 + oss-xfs/master tree.
First of all, this series picks up Christoph's xfsbufd removal series (patches 1-10). I've fixed all the known problems and made all the changes suggested by myself and others in review. It passes 106 just fine, too. ;)
The next series (patches 11-14) are bug fixes and features that I've previously posted. I haven't been able to reproduce Ben's CIL commit sequence assert failure from the async log flushing patch (patch 12/37), so whatever the cause of that problem is is still unknown.
[ Actually, as I wrote this I had a concurrent rm -rf just trip this assert, so the problem is real and I've obviously got more work to do on this one.... ]
Following that is the buffer cache cleanup series (patches 15-26). That is all essentially unchanged, except for a couple of minor fixes from review comments.
Next up is a fix for XFS_IOC_ALLOCSP, followed by a previously posted but unreviewed series (patches 28-34) that cleans up some includes, removes xfs_rw.[ch] and moves all the busy extent handling out to it's own file. This is all to make it easier to merge code with userspace.
Finally, 3 new patches that clean up an issue seen in buffer flag handling, fixes a log mount failure oops, and a further buffer flag cleanup by making the dominant behaviour the default and not needing flags to be specified.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 5/37 xfs: don't flush inodes from background inode reclaim
From: Christoph Hellwig <[email protected]>
We already flush dirty inodes throug the AIL regularly, there is no reason to have second thread compete with it and disturb the I/O pattern. We still do write inodes when doing a synchronous reclaim from the shrinker or during unmount for now.
--- fs/xfs/xfs_sync.c | 102 ++++++++++++++++++++++------------------------------- 1 file changed, 42 insertions(+), 60 deletions(-)
fs/xfs/xfs_sync.c +42 -60
@@ -631,11 +631,8 @@ xfs_reclaim_inode_grab( }/* -* Inodes in different states need to be treated differently, and the return -* value of xfs_iflush is not sufficient to get this right. The following table -* lists the inode states and the reclaim actions necessary for non-blocking -* reclaim: -* +* Inodes in different states need to be treated differently. The following +* table lists the inode states and the reclaim actions necessary: * * inode state iflush ret required action * --------------- ---------- ---------------
@@ -645,9 +642,8 @@ xfs_reclaim_inode_grab(* stale, unpinned 0 reclaim * clean, pinned(*) 0 requeue * stale, pinned EAGAIN requeue -* dirty, delwri ok 0 requeue -* dirty, delwri blocked EAGAIN requeue -* dirty, sync flush 0 reclaim +* dirty, async - requeue +* dirty, sync 0 reclaim * * (*) dgc: I don't think the clean, pinned state is possible but it gets * handled anyway given the order of checks implemented.
@@ -658,26 +654,23 @@ xfs_reclaim_inode_grab(* * Also, because we get the flush lock first, we know that any inode that has * been flushed delwri has had the flush completed by the time we check that -* the inode is clean. The clean inode check needs to be done before flushing -* the inode delwri otherwise we would loop forever requeuing clean inodes as -* we cannot tell apart a successful delwri flush and a clean inode from the -* return value of xfs_iflush(). +* the inode is clean. * -* Note that because the inode is flushed delayed write by background -* writeback, the flush lock may already be held here and waiting on it can -* result in very long latencies. Hence for sync reclaims, where we wait on the -* flush lock, the caller should push out delayed write inodes first before -* trying to reclaim them to minimise the amount of time spent waiting. For -* background relaim, we just requeue the inode for the next pass. +* Note that because the inode is flushed delayed write by AIL pushing, the +* flush lock may already be held here and waiting on it can result in very +* long latencies. Hence for sync reclaims, where we wait on the flush lock, +* the caller should push the AIL first before trying to reclaim inodes to +* minimise the amount of time spent waiting. For background relaim, we only +* bother to reclaim clean inodes anyway. * * Hence the order of actions after gaining the locks should be: * bad => reclaim * shutdown => unpin and reclaim -* pinned, delwri => requeue +* pinned, async => requeue * pinned, sync => unpin * stale => reclaim * clean => reclaim -* dirty, delwri => flush and requeue +* dirty, async => requeue * dirty, sync => flush, wait and reclaim */ STATIC int
@@ -716,10 +709,8 @@ restart: goto reclaim; }if (xfs_ipincount (ip)) { -if (!(sync_mode &SYNC_WAIT )) { -xfs_ifunlock (ip); - goto out; - } +if (!(sync_mode &SYNC_WAIT )) + goto out_ifunlock;xfs_iunpin_wait (ip); }if (xfs_iflags_test (ip,XFS_ISTALE ))
@@ -728,6 +719,13 @@ restart: goto reclaim;/* +* Never flush out dirty data during non-blocking reclaim, as it would +* just contend with AIL pushing trying to do the same job. +*/ +if (!(sync_mode &SYNC_WAIT )) + goto out_ifunlock; + +/* * Now we have an inode that needs flushing. * * We do a nonblocking flush here even if we are doing a SYNC_WAIT
@@ -745,42 +743,13 @@ restart:* pass through will see the stale flag set on the inode. */ error =xfs_iflush (ip,SYNC_TRYLOCK | sync_mode); -if (sync_mode &SYNC_WAIT ) { -if (error ==EAGAIN ) { -xfs_iunlock (ip,XFS_ILOCK_EXCL ); -/* backoff longer than in xfs_ifree_cluster */ -delay (2 ); - goto restart; - } -xfs_iflock (ip); - goto reclaim; - } - -/* -* When we have to flush an inode but don't have SYNC_WAIT set, we -* flush the inode out using a delwri buffer and wait for the next -* 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 reclaim the inode and -* pass on the error. -*/ -if (error && error !=EAGAIN && !XFS_FORCED_SHUTDOWN (ip->i_mount)) { -xfs_warn (ip->i_mount, -"inode 0x%llx background reclaim flush failed with %d" , - (long long )ip->i_ino, error); +if (error ==EAGAIN ) { +xfs_iunlock (ip,XFS_ILOCK_EXCL ); +/* backoff longer than in xfs_ifree_cluster */ +delay (2 ); + goto restart; } -out: -xfs_iflags_clear (ip,XFS_IRECLAIM ); -xfs_iunlock (ip,XFS_ILOCK_EXCL ); -/* -* We could return EAGAIN here to make reclaim rescan the inode tree in -* a short while. However, this just burns CPU time scanning the tree -* waiting for IO to complete and xfssyncd never goes back to the idle -* state. Instead, return 0 to let the next scheduled background reclaim -* attempt to reclaim the inode again. -*/ -return 0 ; +xfs_iflock (ip); reclaim:xfs_ifunlock (ip);
@@ -814,8 +783,21 @@ reclaim:xfs_iunlock (ip,XFS_ILOCK_EXCL );xfs_inode_free (ip); -return error; + +out_ifunlock: +xfs_ifunlock (ip); +out: +xfs_iflags_clear (ip,XFS_IRECLAIM ); +xfs_iunlock (ip,XFS_ILOCK_EXCL ); +/* +* We could return EAGAIN here to make reclaim rescan the inode tree in +* a short while. However, this just burns CPU time scanning the tree +* waiting for IO to complete and xfssyncd never goes back to the idle +* state. Instead, return 0 to let the next scheduled background reclaim +* attempt to reclaim the inode again. +*/ +return 0 ; }/*
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/37 xfs: allow assigning the tail lsn with the AIL lock held
In reply to Dave ChinnerFrom: Christoph Hellwig <[email protected]>
Provide a variant of xlog_assign_tail_lsn that has the AIL lock already held. By doing so we do an additional atomic_read + atomic_set under the lock, which comes down to two instructions.
Switch xfs_trans_ail_update_bulk and xfs_trans_ail_delete_bulk to the new version to reduce the number of lock roundtrips, and prepare for a new addition that would require a third lock roundtrip in xfs_trans_ail_delete_bulk. This addition is also the reason for slightly rearranging the conditionals and relying on xfs_log_space_wake for checking that the filesystem has been shut down internally.
--- fs/xfs/xfs_log.c | 31 +++++++++++++++++++++++-------- fs/xfs/xfs_log.h | 1 + fs/xfs/xfs_trans_ail.c | 22 +++++++++++++++------- fs/xfs/xfs_trans_priv.h | 1 + 4 files changed, 40 insertions(+), 15 deletions(-)
fs/xfs/xfs_log.c +23 -8
@@ -916,27 +916,42 @@ xfs_log_need_covered(xfs_mount_t *mp)* We may be holding the log iclog lock upon entering this routine. */ xfs_lsn_t -xlog_assign_tail_lsn ( +xlog_assign_tail_lsn_locked (struct xfs_mount *mp) { -xfs_lsn_t tail_lsn;struct log *log = mp->m_log; +struct xfs_log_item *lip; +xfs_lsn_t tail_lsn; + +assert_spin_locked (&mp->m_ail->xa_lock);/* * To make sure we always have a valid LSN for the log tail we keep * track of the last LSN which was committed in log->l_last_sync_lsn, -* and use that when the AIL was empty and xfs_ail_min_lsn returns 0. -* -* If the AIL has been emptied we also need to wake any process -* waiting for this condition. +* and use that when the AIL was empty. */ - tail_lsn =xfs_ail_min_lsn (mp->m_ail); -if (!tail_lsn) + lip =xfs_ail_min (mp->m_ail); +if (lip) + tail_lsn = lip->li_lsn; +else tail_lsn =atomic64_read (&log->l_last_sync_lsn);atomic64_set (&log->l_tail_lsn, tail_lsn);return tail_lsn; } +xfs_lsn_t +xlog_assign_tail_lsn ( +struct xfs_mount *mp) +{ +xfs_lsn_t tail_lsn; + +spin_lock (&mp->m_ail->xa_lock); + tail_lsn =xlog_assign_tail_lsn_locked (mp); +spin_unlock (&mp->m_ail->xa_lock); + +return tail_lsn; +} +/* * Return the space in the log between the tail and the head. The head * is passed in the cycle/bytes formal parms. In the special case where
fs/xfs/xfs_log.h +1 -0
@@ -152,6 +152,7 @@ int xfs_log_mount(struct xfs_mount *mp, int num_bblocks);int xfs_log_mount_finish (struct xfs_mount *mp);xfs_lsn_t xlog_assign_tail_lsn (struct xfs_mount *mp); +xfs_lsn_t xlog_assign_tail_lsn_locked (struct xfs_mount *mp);void xfs_log_space_wake (struct xfs_mount *mp); int xfs_log_notify(struct xfs_mount *mp, struct xlog_in_core *iclog,
fs/xfs/xfs_trans_ail.c +15 -7
@@ -79,7 +79,7 @@ xfs_ail_check(* Return a pointer to the first item in the AIL. If the AIL is empty, then * return NULL. */ -static xfs_log_item_t * +xfs_log_item_t *xfs_ail_min (struct xfs_ail *ailp) {
@@ -667,11 +667,15 @@ xfs_trans_ail_update_bulk(if (!list_empty (&tmp))xfs_ail_splice (ailp, cur, &tmp, lsn); -spin_unlock (&ailp->xa_lock); -if (mlip_changed && !XFS_FORCED_SHUTDOWN (ailp->xa_mount)) { -xlog_assign_tail_lsn (ailp->xa_mount); +if (mlip_changed) { +if (!XFS_FORCED_SHUTDOWN (ailp->xa_mount)) +xlog_assign_tail_lsn_locked (ailp->xa_mount); +spin_unlock (&ailp->xa_lock); +xfs_log_space_wake (ailp->xa_mount); + }else { +spin_unlock (&ailp->xa_lock); } }
@@ -729,11 +733,15 @@ xfs_trans_ail_delete_bulk(if (mlip == lip) mlip_changed =1 ; } -spin_unlock (&ailp->xa_lock); -if (mlip_changed && !XFS_FORCED_SHUTDOWN (ailp->xa_mount)) { -xlog_assign_tail_lsn (ailp->xa_mount); +if (mlip_changed) { +if (!XFS_FORCED_SHUTDOWN (ailp->xa_mount)) +xlog_assign_tail_lsn_locked (ailp->xa_mount); +spin_unlock (&ailp->xa_lock); +xfs_log_space_wake (ailp->xa_mount); + }else { +spin_unlock (&ailp->xa_lock); } }
fs/xfs/xfs_trans_priv.h +1 -0
@@ -102,6 +102,7 @@ xfs_trans_ail_delete(void xfs_ail_push (struct xfs_ail *,xfs_lsn_t );void xfs_ail_push_all (struct xfs_ail *); +struct xfs_log_item *xfs_ail_min (struct xfs_ail *ailp);xfs_lsn_t xfs_ail_min_lsn (struct xfs_ail *ailp); struct xfs_log_item * xfs_trans_ail_cursor_first(struct xfs_ail *ailp,
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/37 xfs: remove log item from AIL in xfs_iflush after a shutdown
In reply to Dave ChinnerFrom: Christoph Hellwig <[email protected]>
If a filesystem has been forced shutdown we are never going to write inodes to disk, which means the inode items will stay in the AIL until we free the inode. Currently that is not a problem, but a pending change requires us to empty the AIL before shutting down the filesystem. In that case leaving the inode in the AIL is lethal. Make sure to remove the log item from the AIL to allow emptying the AIL on shutdown filesystems.
--- fs/xfs/xfs_dquot.c | 3 +-- fs/xfs/xfs_iget.c | 18 +----------------- fs/xfs/xfs_inode.c | 17 +++++++++-------- fs/xfs/xfs_sync.c | 1 + 4 files changed, 12 insertions(+), 27 deletions(-)
fs/xfs/xfs_dquot.c +1 -2
@@ -915,8 +915,7 @@ xfs_qm_dqflush(spin_lock (&mp->m_ail->xa_lock);if (lip->li_flags &XFS_LI_IN_AIL ) -xfs_trans_ail_delete (mp->m_ail, lip, -SHUTDOWN_CORRUPT_INCORE ); +xfs_trans_ail_delete (mp->m_ail, lip);else spin_unlock (&mp->m_ail->xa_lock);
fs/xfs/xfs_iget.c +1 -17
@@ -123,23 +123,7 @@ xfs_inode_free(xfs_idestroy_fork (ip,XFS_ATTR_FORK );if (ip->i_itemp) { -/* -* Only if we are shutting down the fs will we see an -* inode still in the AIL. If it is there, we should remove -* it to prevent a use-after-free from occurring. -*/ -xfs_log_item_t *lip = &ip->i_itemp->ili_item; -struct xfs_ail *ailp = lip->li_ailp; - -ASSERT (((lip->li_flags &XFS_LI_IN_AIL ) ==0 ) || -XFS_FORCED_SHUTDOWN (ip->i_mount)); -if (lip->li_flags &XFS_LI_IN_AIL ) { -spin_lock (&ailp->xa_lock); -if (lip->li_flags &XFS_LI_IN_AIL ) -xfs_trans_ail_delete (ailp, lip); -else -spin_unlock (&ailp->xa_lock); - } +ASSERT (!(ip->i_itemp->ili_item.li_flags &XFS_LI_IN_AIL ));xfs_inode_item_destroy (ip); ip->i_itemp =NULL ; }
fs/xfs/xfs_inode.c +9 -8
@@ -2397,7 +2397,6 @@ xfs_iflush( xfs_inode_t *ip, uint flags) { -xfs_inode_log_item_t *iip;xfs_buf_t *bp;xfs_dinode_t *dip;xfs_mount_t *mp;
@@ -2410,7 +2409,6 @@ xfs_iflush(ASSERT (ip->i_d.di_format !=XFS_DINODE_FMT_BTREE || ip->i_d.di_nextents >XFS_IFORK_MAXEXT (ip,XFS_DATA_FORK )); - iip = ip->i_itemp; mp = ip->i_mount;/*
@@ -2447,13 +2445,14 @@ xfs_iflush(/* * This may have been unpinned because the filesystem is shutting * down forcibly. If that's the case we must not write this inode -* to disk, because the log record didn't make it to disk! +* to disk, because the log record didn't make it to disk. +* +* We also have to remove the log item from the AIL in this case, +* as we wait for an empty AIL as part of the unmount process. */ if (XFS_FORCED_SHUTDOWN (mp)) { -if (iip) - iip->ili_fields =0 ; -xfs_ifunlock (ip); -return XFS_ERROR (EIO ); + error =XFS_ERROR (EIO ); + goto abort_out; }/*
@@ -2500,11 +2499,13 @@ corrupt_out:xfs_buf_relse (bp);xfs_force_shutdown (mp,SHUTDOWN_CORRUPT_INCORE ); cluster_corrupt_out: + error =XFS_ERROR (EFSCORRUPTED ); +abort_out:/* * Unlocks the flush lock */ xfs_iflush_abort (ip); -return XFS_ERROR (EFSCORRUPTED ); +return error; }
fs/xfs/xfs_sync.c +1 -0
@@ -782,6 +782,7 @@ restart: goto reclaim;if (XFS_FORCED_SHUTDOWN (ip->i_mount)) {xfs_iunpin_wait (ip); +xfs_iflush_abort (ip); goto reclaim; }if (xfs_ipincount (ip)) {
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 8/37 xfs: do not add buffers to the delwri queue until pushed
In reply to Dave ChinnerFrom: Christoph Hellwig <[email protected]>
Instead of adding buffers to the delwri list as soon as they are logged, even if they can't be written until commited because they are pinned defer adding them to the delwri list until xfsaild pushes them. This makes the code more similar to other log items and prepares for writing buffers directly from xfsaild.
The complication here is that we need to fail buffers that were added but not logged yet in xfs_buf_item_unpin, borrowing code from xfs_bioerror.
--- fs/xfs/xfs_buf_item.c | 11 ++++++++--- fs/xfs/xfs_trans_buf.c | 2 -- 2 files changed, 8 insertions(+), 5 deletions(-)
fs/xfs/xfs_buf_item.c +8 -3
@@ -460,6 +460,12 @@ xfs_buf_item_unpin(ASSERT (bp->b_fspriv ==NULL ); }xfs_buf_relse (bp); + }else if (freed && remove) { +xfs_buf_lock (bp); +xfs_buf_ioerror (bp,EIO ); +XFS_BUF_UNDONE (bp); +xfs_buf_stale (bp); +xfs_buf_ioend (bp,0 ); } }
@@ -604,9 +610,7 @@ xfs_buf_item_committed( }/* -* The buffer is locked, but is not a delayed write buffer. This happens -* if we race with IO completion and hence we don't want to try to write it -* again. Just release the buffer. +* The buffer is locked, but is not a delayed write buffer. */ STATIC void xfs_buf_item_push(
@@ -620,6 +624,7 @@ xfs_buf_item_push(trace_xfs_buf_item_push (bip); +xfs_buf_delwri_queue (bp);xfs_buf_relse (bp); }
fs/xfs/xfs_trans_buf.c +0 -2
@@ -626,8 +626,6 @@ xfs_trans_log_buf(xfs_trans_t *tp, bp->b_iodone = xfs_buf_iodone_callbacks; bip->bli_item.li_cb = xfs_buf_iodone; -xfs_buf_delwri_queue (bp); -trace_xfs_trans_log_buf (bip);/*
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 4/37 xfs: implement freezing by emptying the AIL
In reply to Dave ChinnerFrom: Christoph Hellwig <[email protected]>
Now that we write back all metadata either synchronously or through the AIL we can simply implement metadata freezing in terms of emptying the AIL.
The implementation for this is fairly simply and straight-forward:
A new routine is added that asks the xfsaild to push the AIL to the end and waits for it to complete and send a wakeup. The routine will then loop if the AIL is not actually empty, and continue to do so until the AIL is compeltely empty.
We keep an inode reclaim pass in the freeze process to avoid having memory pressure have to reclaim inodes that require dirtying the filesystem to be reclaimed after the freeze has completed. This means we can also treat unmount in the exact same way as freeze.
As an upside we can now remove the radix tree based inode writeback and xfs_unmountfs_writesb.
[ Dave Chinner:
- Cleaned up commit message.
- Added inode reclaim passes back into freeze.
- Cleaned up wakeup mechanism to avoid the use of a new sleep counter variable. ]
--- fs/xfs/xfs_mount.c | 56 ++++++--------------------- fs/xfs/xfs_mount.h | 1 - fs/xfs/xfs_sync.c | 96 +++++++---------------------------------------- fs/xfs/xfs_trans_ail.c | 36 ++++++++++++++---- fs/xfs/xfs_trans_priv.h | 2 + 5 files changed, 56 insertions(+), 135 deletions(-)
fs/xfs/xfs_mount.c +12 -44
@@ -22,6 +22,7 @@#include "xfs_log.h" #include "xfs_inum.h" #include "xfs_trans.h" +#include "xfs_trans_priv.h" #include "xfs_sb.h" #include "xfs_ag.h" #include "xfs_dir2.h"
@@ -1475,15 +1476,15 @@ xfs_unmountfs(xfs_log_force (mp,XFS_LOG_SYNC );/* -* Do a delwri reclaim pass first so that as many dirty inodes are -* queued up for IO as possible. Then flush the buffers before making -* a synchronous path to catch all the remaining inodes are reclaimed. -* This makes the reclaim process as quick as possible by avoiding -* synchronous writeout and blocking on inodes already in the delwri -* state as much as possible. +* Flush all pending changes from the AIL. +*/ +xfs_ail_push_all_sync (mp->m_ail); + +/* +* And reclaim all inodes. At this point there should be no dirty +* inode, and none should be pinned or locked, but use synchronous +* reclaim just to be sure. */ -xfs_reclaim_inodes (mp,0 ); -xfs_flush_buftarg (mp->m_ddev_targp,1 );xfs_reclaim_inodes (mp,SYNC_WAIT );xfs_qm_unmount (mp);
@@ -1519,15 +1520,12 @@ xfs_unmountfs(if (error)xfs_warn (mp,"Unable to update superblock counters. " "Freespace may not be correct on next mount." ); -xfs_unmountfs_writesb (mp);/* -* Make sure all buffers have been flushed and completed before -* unmounting the log. +* At this point we might have modified the superblock again and thus +* added an item to the AIL, thus flush it again. */ - error =xfs_flush_buftarg (mp->m_ddev_targp,1 ); -if (error) -xfs_warn (mp,"%d busy buffers during unmount." , error); +xfs_ail_push_all_sync (mp->m_ail);xfs_wait_buftarg (mp->m_ddev_targp);xfs_log_unmount_write (mp);
@@ -1588,36 +1586,6 @@ xfs_log_sbcount(xfs_mount_t *mp)return error; } -int -xfs_unmountfs_writesb (xfs_mount_t *mp) -{ -xfs_buf_t *sbp; -int error =0 ; - -/* -* skip superblock write if fs is read-only, or -* if we are doing a forced umount. -*/ -if (!((mp->m_flags &XFS_MOUNT_RDONLY ) || -XFS_FORCED_SHUTDOWN (mp))) { - - sbp =xfs_getsb (mp,0 ); - -XFS_BUF_UNDONE (sbp); -XFS_BUF_UNREAD (sbp); -xfs_buf_delwri_dequeue (sbp); -XFS_BUF_WRITE (sbp); -XFS_BUF_UNASYNC (sbp); -ASSERT (sbp->b_target == mp->m_ddev_targp); -xfsbdstrat (mp, sbp); - error =xfs_buf_iowait (sbp); -if (error) -xfs_buf_ioerror_alert (sbp, __func__); -xfs_buf_relse (sbp); - } -return error; -} -/* * xfs_mod_sb() can be used to copy arbitrary changes to the * in-core superblock into the superblock buffer to be logged.
fs/xfs/xfs_mount.h +0 -1
@@ -375,7 +375,6 @@ extern __uint64_t xfs_default_resblks(xfs_mount_t *mp);extern int xfs_mountfs (xfs_mount_t *mp);extern void xfs_unmountfs (xfs_mount_t *); -extern int xfs_unmountfs_writesb (xfs_mount_t *);extern int xfs_mod_incore_sb (xfs_mount_t *,xfs_sb_field_t ,int64_t ,int );extern int xfs_mod_incore_sb_batch (xfs_mount_t *,xfs_mod_sb_t *,uint ,int );
fs/xfs/xfs_sync.c +13 -83
132 lines not on this page · raw message
fs/xfs/xfs_trans_ail.c +29 -7
@@ -383,9 +383,8 @@ xfsaild_push(spin_lock (&ailp->xa_lock); } - target = ailp->xa_target; lip =xfs_trans_ail_cursor_first (ailp, &cur, ailp->xa_last_pushed_lsn); -if (!lip ||XFS_FORCED_SHUTDOWN (mp)) { +if (!lip) {/* * AIL is empty or our push has reached the end. */
@@ -408,6 +407,7 @@ xfsaild_push(* lots of contention on the AIL lists. */ lsn = lip->li_lsn; + target = ailp->xa_target;while ((XFS_LSN_CMP (lip->li_lsn, target) <=0 )) {int lock_result;/*
@@ -466,11 +466,6 @@ xfsaild_push( }spin_lock (&ailp->xa_lock); -/* should we bother continuing? */ -if (XFS_FORCED_SHUTDOWN (mp)) -break ; -ASSERT (mp->m_log); - count++;/*
@@ -611,6 +606,30 @@ xfs_ail_push_all( }/* +* Push out all items in the AIL immediately and wait until the AIL is empty. +*/ +void +xfs_ail_push_all_sync ( +struct xfs_ail *ailp) +{ +struct xfs_log_item *lip; +DEFINE_WAIT (wait); + +spin_lock (&ailp->xa_lock); +while ((lip =xfs_ail_max (ailp)) !=NULL ) { +prepare_to_wait (&ailp->xa_empty, &wait,TASK_UNINTERRUPTIBLE ); + ailp->xa_target = lip->li_lsn; +wake_up_process (ailp->xa_task); +spin_unlock (&ailp->xa_lock); +schedule (); +spin_lock (&ailp->xa_lock); + } +spin_unlock (&ailp->xa_lock); + +finish_wait (&ailp->xa_empty, &wait); +} + +/* * xfs_trans_ail_update - bulk AIL insertion operation. * * @xfs_trans_ail_update takes an array of log items that all need to be
@@ -737,6 +756,8 @@ xfs_trans_ail_delete_bulk(if (mlip_changed) {if (!XFS_FORCED_SHUTDOWN (ailp->xa_mount))xlog_assign_tail_lsn_locked (ailp->xa_mount); +if (list_empty (&ailp->xa_ail)) +wake_up_all (&ailp->xa_empty);spin_unlock (&ailp->xa_lock);xfs_log_space_wake (ailp->xa_mount);
@@ -773,6 +794,7 @@ xfs_trans_ail_init(INIT_LIST_HEAD (&ailp->xa_ail);INIT_LIST_HEAD (&ailp->xa_cursors);spin_lock_init (&ailp->xa_lock); +init_waitqueue_head (&ailp->xa_empty); ailp->xa_task =kthread_run (xfsaild, ailp,"xfsaild/%s" , ailp->xa_mount->m_fsname);
fs/xfs/xfs_trans_priv.h +2 -0
@@ -71,6 +71,7 @@ struct xfs_ail {spinlock_t xa_lock;xfs_lsn_t xa_last_pushed_lsn;int xa_log_flush; +wait_queue_head_t xa_empty; };/*
@@ -102,6 +103,7 @@ xfs_trans_ail_delete(void xfs_ail_push (struct xfs_ail *,xfs_lsn_t );void xfs_ail_push_all (struct xfs_ail *); +void xfs_ail_push_all_sync (struct xfs_ail *);struct xfs_log_item *xfs_ail_min (struct xfs_ail *ailp);xfs_lsn_t xfs_ail_min_lsn (struct xfs_ail *ailp);
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 10/37 xfs: remove some obsolete comments in xfs_trans_ail.c
In reply to Dave ChinnerFrom: Christoph Hellwig <[email protected]>
--- fs/xfs/xfs_trans_ail.c | 14 -------------- 1 file changed, 14 deletions(-)
fs/xfs/xfs_trans_ail.c +0 -14
@@ -750,20 +750,6 @@ xfs_trans_ail_delete_bulk( } } -/* -* The active item list (AIL) is a doubly linked list of log -* items sorted by ascending lsn. The base of the list is -* a forw/back pointer pair embedded in the xfs mount structure. -* The base is initialized with both pointers pointing to the -* base. This case always needs to be distinguished, because -* the base has no lsn to look at. We almost always insert -* at the end of the list, so on inserts we search from the -* end of the list to find where the new item belongs. -*/ - -/* -* Initialize the doubly linked list to point only to itself. -*/ int xfs_trans_ail_init (xfs_mount_t *mp)
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 17/37 xfs: fix incorrect b_offset initialisation
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Because we no longer use the page cache for buffering, there is no direct block number to page offset relationship anymore. xfs_buf_get_pages is still setting up b_offset as if there was some relationship, and that is leading to incorrectly setting up *uncached* buffers that don't overwrite b_offset once they've had pages allocated.
For cached buffers, the first block of the buffer is always at offset zero into the allocated memory. This is true for sub-page sized buffers, as well as for multiple-page buffers.
For uncached buffers, b_offset is only non-zero when we are associating specific memory to the buffers, and that is set correctly by the code setting up the buffer.
Hence remove the setting of b_offset in xfs_buf_get_pages, because it is now always the wrong thing to do.
--- fs/xfs/xfs_buf.c | 1 - 1 file changed, 1 deletion(-)
fs/xfs/xfs_buf.c +0 -1
@@ -227,7 +227,6 @@ _xfs_buf_get_pages( {/* Make sure that we have a page list */ if (bp->b_pages ==NULL ) { - bp->b_offset =xfs_buf_poff (bp->b_file_offset); bp->b_page_count = page_count;if (page_count <=XB_PAGES ) { bp->b_pages = bp->b_page_array;
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 6/37 xfs: do not write the buffer from xfs_iflush
In reply to Dave ChinnerFrom: Christoph Hellwig <[email protected]>
Instead of writing the buffer directly from inside xfs_iflush return it to the caller and let the caller decide what to do with the buffer. Also remove the pincount check in xfs_iflush that all non-blocking callers already implement and the now unused flags parameter.
--- fs/xfs/xfs_inode.c | 54 ++++++++++++++--------------------------------- fs/xfs/xfs_inode.h | 2 +- fs/xfs/xfs_inode_item.c | 17 ++++++++++++++- fs/xfs/xfs_sync.c | 29 +++++++++++++------------ 4 files changed, 48 insertions(+), 54 deletions(-)
fs/xfs/xfs_inode.c +16 -38
@@ -2384,22 +2384,22 @@ cluster_corrupt_out: }/* -* xfs_iflush() will write a modified inode's changes out to the -* inode's on disk home. The caller must have the inode lock held -* in at least shared mode and the inode flush completion must be -* active as well. The inode lock will still be held upon return from -* the call and the caller is free to unlock it. -* The inode flush will be completed when the inode reaches the disk. -* The flags indicate how the inode's buffer should be written out. +* Flush dirty inode metadata into the backing buffer. +* +* The caller must have the inode lock and the inode flush lock held. The +* inode lock will still be held upon return to the caller, and the inode +* flush lock will be released after the inode has reached the disk. +* +* The caller must write out the buffer returned in *bpp and release it. */ int xfs_iflush ( -xfs_inode_t *ip, -uint flags) +struct xfs_inode *ip, +struct xfs_buf **bpp) { -xfs_buf_t *bp; -xfs_dinode_t *dip; -xfs_mount_t *mp; +struct xfs_mount *mp = ip->i_mount; +struct xfs_buf *bp; +struct xfs_dinode *dip;int error;XFS_STATS_INC (xs_iflush_count);
@@ -2409,24 +2409,8 @@ xfs_iflush(ASSERT (ip->i_d.di_format !=XFS_DINODE_FMT_BTREE || ip->i_d.di_nextents >XFS_IFORK_MAXEXT (ip,XFS_DATA_FORK )); - mp = ip->i_mount; + *bpp =NULL ; -/* -* We can't flush the inode until it is unpinned, so wait for it if we -* are allowed to block. We know no one new can pin it, because we are -* holding the inode lock shared and you need to hold it exclusively to -* pin the inode. -* -* If we are not allowed to block, force the log out asynchronously so -* that when we come back the inode will be unpinned. If other inodes -* in the same cluster are dirty, they will probably write the inode -* out for us if they occur after the log force completes. -*/ -if (!(flags &SYNC_WAIT ) &&xfs_ipincount (ip)) { -xfs_iunpin (ip); -xfs_ifunlock (ip); -return EAGAIN ; - }xfs_iunpin_wait (ip);/*
@@ -2458,8 +2442,7 @@ xfs_iflush(/* * Get the buffer containing the on-disk inode. */ - error =xfs_itobp (mp,NULL , ip, &dip, &bp, - (flags &SYNC_TRYLOCK ) ?XBF_TRYLOCK :XBF_LOCK ); + error =xfs_itobp (mp,NULL , ip, &dip, &bp,XBF_TRYLOCK );if (error || !bp) {xfs_ifunlock (ip);return error;
@@ -2487,13 +2470,8 @@ xfs_iflush(if (error) goto cluster_corrupt_out; -if (flags &SYNC_WAIT ) - error =xfs_bwrite (bp); -else -xfs_buf_delwri_queue (bp); - -xfs_buf_relse (bp); -return error; + *bpp = bp; +return 0 ; corrupt_out:xfs_buf_relse (bp);
fs/xfs/xfs_inode.h +1 -1
@@ -529,7 +529,7 @@ int xfs_iunlink(struct xfs_trans *, xfs_inode_t *);void xfs_iext_realloc (xfs_inode_t *,int ,int );void xfs_iunpin_wait (xfs_inode_t *); -int xfs_iflush (xfs_inode_t *,uint ); +int xfs_iflush (struct xfs_inode *,struct xfs_buf **);void xfs_promote_inode (struct xfs_inode *);void xfs_lock_inodes (xfs_inode_t **,int ,uint );void xfs_lock_two_inodes (xfs_inode_t *,xfs_inode_t *,uint );
fs/xfs/xfs_inode_item.c +16 -1
@@ -506,6 +506,15 @@ xfs_inode_item_trylock(if (!xfs_ilock_nowait (ip,XFS_ILOCK_SHARED ))return XFS_ITEM_LOCKED ; +/* +* Re-check the pincount now that we stabilized the value by +* taking the ilock. +*/ +if (xfs_ipincount (ip) >0 ) { +xfs_iunlock (ip,XFS_ILOCK_SHARED ); +return XFS_ITEM_PINNED ; + } +if (!xfs_iflock_nowait (ip)) {/* * inode has already been flushed to the backing buffer,
@@ -666,6 +675,8 @@ xfs_inode_item_push( {struct xfs_inode_log_item *iip =INODE_ITEM (lip);struct xfs_inode *ip = iip->ili_inode; +struct xfs_buf *bp =NULL ; +int error;ASSERT (xfs_isilocked (ip,XFS_ILOCK_SHARED ));ASSERT (xfs_isiflocked (ip));
@@ -689,7 +700,11 @@ xfs_inode_item_push(* will pull the inode from the AIL, mark it clean and unlock the flush * lock. */ - (void )xfs_iflush (ip,SYNC_TRYLOCK ); + error =xfs_iflush (ip, &bp); +if (!error) { +xfs_buf_delwri_queue (bp); +xfs_buf_relse (bp); + }xfs_iunlock (ip,XFS_ILOCK_SHARED ); }
fs/xfs/xfs_sync.c +15 -14
@@ -648,10 +648,6 @@ xfs_reclaim_inode_grab(* (*) dgc: I don't think the clean, pinned state is possible but it gets * handled anyway given the order of checks implemented. * -* As can be seen from the table, the return value of xfs_iflush() is not -* sufficient to correctly decide the reclaim action here. The checks in -* xfs_iflush() might look like duplicates, but they are not. -* * Also, because we get the flush lock first, we know that any inode that has * been flushed delwri has had the flush completed by the time we check that * the inode is clean.
@@ -679,7 +675,8 @@ xfs_reclaim_inode( struct xfs_perag *pag, int sync_mode) { -int error; +struct xfs_buf *bp =NULL ; +int error; restart: error =0 ;
@@ -728,29 +725,33 @@ restart:/* * Now we have an inode that needs flushing. * -* We do a nonblocking flush here even if we are doing a SYNC_WAIT -* reclaim as we can deadlock with inode cluster removal. +* Note that xfs_iflush will never block on the inode buffer lock, as * xfs_ifree_cluster() can lock the inode buffer before it locks the -* ip->i_lock, and we are doing the exact opposite here. As a result, -* doing a blocking xfs_itobp() to get the cluster buffer will result +* ip->i_lock, and we are doing the exact opposite here. As a result, +* doing a blocking xfs_itobp() to get the cluster buffer would result * in an ABBA deadlock with xfs_ifree_cluster(). * * As xfs_ifree_cluser() must gather all inodes that are active in the * cache to mark them stale, if we hit this case we don't actually want * to do IO here - we want the inode marked stale so we can simply -* reclaim it. Hence if we get an EAGAIN error on a SYNC_WAIT flush, -* just unlock the inode, back off and try again. Hopefully the next -* pass through will see the stale flag set on the inode. +* reclaim it. Hence if we get an EAGAIN error here, just unlock the +* inode, back off and try again. Hopefully the next pass through will +* see the stale flag set on the inode. */ - error =xfs_iflush (ip,SYNC_TRYLOCK | sync_mode); + error =xfs_iflush (ip, &bp);if (error ==EAGAIN ) {xfs_iunlock (ip,XFS_ILOCK_EXCL );/* backoff longer than in xfs_ifree_cluster */ delay (2 ); goto restart; } -xfs_iflock (ip); +if (!error) { + error =xfs_bwrite (bp); +xfs_buf_relse (bp); + } + +xfs_iflock (ip); reclaim:xfs_ifunlock (ip);xfs_iunlock (ip,XFS_ILOCK_EXCL );
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 12/37 xfs: Do background CIL flushes via a workqueue
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Doing background CIL flushes adds significant latency to whatever async transaction that triggers it. To avoid blocking async transactions on things like waiting for log buffer IO to complete, move the CIL push off into a workqueue. By moving the push work into a workqueue, we remove all the latency that the commit adds from the foreground transaction commit path. This also means that single threaded workloads won't do the CIL push procssing, leaving them more CPU to do more async transactions.
To do this, we need to keep track of the sequence number we have pushed work for. This avoids having many transaction commits attempting to schedule work for the same sequence, and ensures that we only ever have one push (background or forced) in progress at a time. It also means that we don't need to take the CIL lock in write mode to check for potential background push races, which reduces lock contention.
To avoid potential issues with "smart" IO schedulers, don't use the workqueue for log force triggered flushes. Instead, do them directly so that the log IO is done directly by the process issuing the log force and so doesn't get stuck on IO elevator queue idling incorrectly delaying the log IO from the workqueue.
--- fs/xfs/xfs_log_cil.c | 241 ++++++++++++++++++++++++++++++------------------- fs/xfs/xfs_log_priv.h | 2 + fs/xfs/xfs_mount.h | 1 + fs/xfs/xfs_super.c | 7 ++ 4 files changed, 157 insertions(+), 94 deletions(-)
fs/xfs/xfs_log_cil.c +147 -94
@@ -32,58 +32,6 @@#include "xfs_discard.h" /* -* Perform initial CIL structure initialisation. -*/ -int -xlog_cil_init ( -struct log *log) -{ -struct xfs_cil *cil; -struct xfs_cil_ctx *ctx; - - cil =kmem_zalloc (sizeof (*cil),KM_SLEEP |KM_MAYFAIL ); -if (!cil) -return ENOMEM ; - - ctx =kmem_zalloc (sizeof (*ctx),KM_SLEEP |KM_MAYFAIL ); -if (!ctx) { -kmem_free (cil); -return ENOMEM ; - } - -INIT_LIST_HEAD (&cil->xc_cil); -INIT_LIST_HEAD (&cil->xc_committing); -spin_lock_init (&cil->xc_cil_lock); -init_rwsem (&cil->xc_ctx_lock); -init_waitqueue_head (&cil->xc_commit_wait); - -INIT_LIST_HEAD (&ctx->committing); -INIT_LIST_HEAD (&ctx->busy_extents); - ctx->sequence =1 ; - ctx->cil = cil; - cil->xc_ctx = ctx; - cil->xc_current_sequence = ctx->sequence; - - cil->xc_log = log; - log->l_cilp = cil; -return 0 ; -} - -void -xlog_cil_destroy ( -struct log *log) -{ -if (log->l_cilp->xc_ctx) { -if (log->l_cilp->xc_ctx->ticket) -xfs_log_ticket_put (log->l_cilp->xc_ctx->ticket); -kmem_free (log->l_cilp->xc_ctx); - } - -ASSERT (list_empty (&log->l_cilp->xc_cil)); -kmem_free (log->l_cilp); -} - -/* * Allocate a new ticket. Failing to get a new ticket makes it really hard to * recover, so we don't allow failure here. Also, we allocate in a context that * we don't want to be issuing transactions from, so we need to tell the
@@ -426,8 +374,7 @@ xlog_cil_committed(*/ STATIC intxlog_cil_push ( -struct log *log, -xfs_lsn_t push_seq) +struct log *log) {struct xfs_cil *cil = log->l_cilp;struct xfs_log_vec *lv;
@@ -443,39 +390,35 @@ xlog_cil_push(struct xfs_log_iovec lhdr;struct xfs_log_vec lvhdr = {NULL };xfs_lsn_t commit_lsn; +xfs_lsn_t push_seq;if (!cil)return 0 ; -ASSERT (!push_seq || push_seq <= cil->xc_ctx->sequence); - new_ctx =kmem_zalloc (sizeof (*new_ctx),KM_SLEEP |KM_NOFS ); new_ctx->ticket =xlog_cil_ticket_alloc (log); -/* -* Lock out transaction commit, but don't block for background pushes -* unless we are well over the CIL space limit. See the definition of -* XLOG_CIL_HARD_SPACE_LIMIT() for the full explanation of the logic -* used here. -*/ -if (!down_write_trylock (&cil->xc_ctx_lock)) { -if (!push_seq && - cil->xc_ctx->space_used <XLOG_CIL_HARD_SPACE_LIMIT (log)) - goto out_free_ticket; -down_write (&cil->xc_ctx_lock); - } +down_write (&cil->xc_ctx_lock); ctx = cil->xc_ctx; -/* check if we've anything to push */ -if (list_empty (&cil->xc_cil)) - goto out_skip; +spin_lock (&cil->xc_cil_lock); + push_seq = cil->xc_push_seq; +ASSERT (push_seq >0 && push_seq <= ctx->sequence); -/* check for spurious background flush */ -if (!push_seq && cil->xc_ctx->space_used <XLOG_CIL_SPACE_LIMIT (log)) +/* +* Check if we've anything to push. If there is nothing, then we don't +* move on to a new sequence number and so we have to be able to push +* this sequence again later. +*/ +if (list_empty (&cil->xc_cil)) { + cil->xc_push_seq =0 ; +spin_unlock (&cil->xc_cil_lock); goto out_skip; + } +spin_unlock (&cil->xc_cil_lock);/* check for a previously pushed seqeunce */ -if (push_seq && push_seq < cil->xc_ctx->sequence) +if (push_seq < cil->xc_ctx->sequence) goto out_skip;/*
@@ -629,7 +572,6 @@ restart: out_skip:up_write (&cil->xc_ctx_lock); -out_free_ticket:xfs_log_ticket_put (new_ctx->ticket);kmem_free (new_ctx);return 0 ;
@@ -641,6 +583,80 @@ out_abort:return XFS_ERROR (EIO ); } +static void +xlog_cil_push_work ( +struct work_struct *work) +{ + struct xfs_cil *cil = container_of(work, struct xfs_cil, + xc_push_work); +xlog_cil_push (cil->xc_log); +} + +/* +* We need to push CIL every so often so we don't cache more than we can fit in +* the log. The limit really is that a checkpoint can't be more than half the +* log (the current checkpoint is not allowed to overwrite the previous +* checkpoint), but commit latency and memory usage limit this to a smaller +* size. +*/ +static void +xlog_cil_push_background ( +struct log *log) +{ +struct xfs_cil *cil = log->l_cilp; + +/* +* The cil won't be empty because we are called while holding the +* context lock so whatever we added to the CIL will still be there +*/ +ASSERT (!list_empty (&cil->xc_cil)); + +/* +* don't do a background push if we haven't used up all the +* space available yet. +*/ +if (cil->xc_ctx->space_used <XLOG_CIL_SPACE_LIMIT (log)) +return ; + +spin_lock (&cil->xc_cil_lock); + cil->xc_push_seq = cil->xc_current_sequence; +queue_work (log->l_mp->m_cil_workqueue, &cil->xc_push_work); +spin_unlock (&cil->xc_cil_lock); + +} + +static void +xlog_cil_push_foreground ( +struct log *log, +xfs_lsn_t push_seq) +{ +struct xfs_cil *cil = log->l_cilp; + +if (!cil) +return ; + +ASSERT (push_seq && push_seq <= cil->xc_current_sequence); + +/* start on any pending background push to minimise wait time on it */ +flush_work (&cil->xc_push_work); + +/* +* If the CIL is empty or we've already pushed the sequence then +* there's no work we need to do. +*/ +spin_lock (&cil->xc_cil_lock); +if (list_empty (&cil->xc_cil) || push_seq <= cil->xc_push_seq) { +spin_unlock (&cil->xc_cil_lock); +return ; + } + + cil->xc_push_seq = push_seq; +spin_unlock (&cil->xc_cil_lock); + +/* do the push now */ +xlog_cil_push (log); +} +/* * Commit a transaction with the given vector to the Committed Item List. *
@@ -667,7 +683,6 @@ xfs_log_commit_cil( {struct log *log = mp->m_log;int log_flags =0 ; -int push =0 ;struct xfs_log_vec *log_vector;if (flags &XFS_TRANS_RELEASE_LOG_RES )
@@ -719,21 +734,9 @@ xfs_log_commit_cil(*/ xfs_trans_free_items (tp, *commit_lsn,0 ); -/* check for background commit before unlock */ -if (log->l_cilp->xc_ctx->space_used >XLOG_CIL_SPACE_LIMIT (log)) - push =1 ; +xlog_cil_push_background (log);up_read (&log->l_cilp->xc_ctx_lock); - -/* -* We need to push CIL every so often so we don't cache more than we -* can fit in the log. The limit really is that a checkpoint can't be -* more than half the log (the current checkpoint is not allowed to -* overwrite the previous checkpoint), but commit latency and memory -* usage limit this to a smaller size in most cases. -*/ -if (push) -xlog_cil_push (log,0 );return 0 ; }
@@ -746,9 +749,6 @@ xfs_log_commit_cil(* * We return the current commit lsn to allow the callers to determine if a * iclog flush is necessary following this call. -* -* XXX: Initially, just push the CIL unconditionally and return whatever -* commit lsn is there. It'll be empty, so this is broken for now. */ xfs_lsn_t xlog_cil_force_lsn(
@@ -766,8 +766,7 @@ xlog_cil_force_lsn(* xlog_cil_push() handles racing pushes for the same sequence, * so no need to deal with it here. */ -if (sequence == cil->xc_current_sequence) -xlog_cil_push (log, sequence); +xlog_cil_push_foreground (log, sequence);/* * See if we can find a previous sequence still committing.
@@ -826,3 +825,57 @@ xfs_log_item_in_current_chkpt(return false;return true; } + +/* +* Perform initial CIL structure initialisation. +*/ +int +xlog_cil_init ( +struct log *log) +{ +struct xfs_cil *cil; +struct xfs_cil_ctx *ctx; + + cil =kmem_zalloc (sizeof (*cil),KM_SLEEP |KM_MAYFAIL ); +if (!cil) +return ENOMEM ; + + ctx =kmem_zalloc (sizeof (*ctx),KM_SLEEP |KM_MAYFAIL ); +if (!ctx) { +kmem_free (cil); +return ENOMEM ; + } + +INIT_WORK (&cil->xc_push_work, xlog_cil_push_work); +INIT_LIST_HEAD (&cil->xc_cil); +INIT_LIST_HEAD (&cil->xc_committing); +spin_lock_init (&cil->xc_cil_lock); +init_rwsem (&cil->xc_ctx_lock); +init_waitqueue_head (&cil->xc_commit_wait); + +INIT_LIST_HEAD (&ctx->committing); +INIT_LIST_HEAD (&ctx->busy_extents); + ctx->sequence =1 ; + ctx->cil = cil; + cil->xc_ctx = ctx; + cil->xc_current_sequence = ctx->sequence; + + cil->xc_log = log; + log->l_cilp = cil; +return 0 ; +} + +void +xlog_cil_destroy ( +struct log *log) +{ +if (log->l_cilp->xc_ctx) { +if (log->l_cilp->xc_ctx->ticket) +xfs_log_ticket_put (log->l_cilp->xc_ctx->ticket); +kmem_free (log->l_cilp->xc_ctx); + } + +ASSERT (list_empty (&log->l_cilp->xc_cil)); +kmem_free (log->l_cilp); +} +
fs/xfs/xfs_log_priv.h +2 -0
@@ -417,6 +417,8 @@ struct xfs_cil {struct list_head xc_committing;wait_queue_head_t xc_commit_wait;xfs_lsn_t xc_current_sequence; +struct work_struct xc_push_work; +xfs_lsn_t xc_push_seq; };/*
fs/xfs/xfs_mount.h +1 -0
@@ -214,6 +214,7 @@ typedef struct xfs_mount {struct workqueue_struct *m_data_workqueue;struct workqueue_struct *m_unwritten_workqueue; +struct workqueue_struct *m_cil_workqueue; } xfs_mount_t;/*
fs/xfs/xfs_super.c +7 -0
@@ -773,8 +773,14 @@ xfs_init_mount_workqueues(if (!mp->m_unwritten_workqueue) goto out_destroy_data_iodone_queue; + mp->m_cil_workqueue =alloc_workqueue ("xfs-cil/%s" , +WQ_MEM_RECLAIM ,0 , mp->m_fsname); +if (!mp->m_cil_workqueue) + goto out_destroy_unwritten;return 0 ; +out_destroy_unwritten: +destroy_workqueue (mp->m_unwritten_workqueue); out_destroy_data_iodone_queue:destroy_workqueue (mp->m_data_workqueue); out:
@@ -785,6 +791,7 @@ STATIC voidxfs_destroy_mount_workqueues ( struct xfs_mount *mp) { +destroy_workqueue (mp->m_cil_workqueue);destroy_workqueue (mp->m_data_workqueue);destroy_workqueue (mp->m_unwritten_workqueue); }
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 18/37 xfs: use kmem_zone_zalloc for buffers
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
To replace the alloc/memset pair.
--- fs/xfs/xfs_buf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/xfs/xfs_buf.c +1 -2
@@ -178,7 +178,7 @@ xfs_buf_alloc( {struct xfs_buf *bp; - bp =kmem_zone_alloc (xfs_buf_zone,xb_to_km (flags)); + bp =kmem_zone_zalloc (xfs_buf_zone,xb_to_km (flags));if (unlikely (!bp))return NULL ;
@@ -187,7 +187,6 @@ xfs_buf_alloc(*/ flags &= ~(XBF_LOCK |XBF_MAPPED |XBF_DONT_BLOCK |XBF_READ_AHEAD ); -memset (bp,0 ,sizeof (xfs_buf_t));atomic_set (&bp->b_hold,1 );atomic_set (&bp->b_lru_ref,1 );init_completion (&bp->b_iowait);
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 16/37 xfs: check for buffer errors before waiting
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
If we call xfs_buf_iowait() on a buffer that failed dispatch due to an IO error, it will wait forever for an Io that does not exist. This is hndled in xfs_buf_read, but there is other code that calls xfs_buf_iowait directly that doesn't.
Rather than make the call sites have to handle checking for dispatch errors and then checking for completion errors, make xfs_buf_iowait() check for dispatch errors on the buffer before waiting. This means we handle both dispatch and completion errors with one set of error handling at the caller sites.
--- fs/xfs/xfs_buf.c | 22 ++++++++++------------ fs/xfs/xfs_buf.h | 2 +- fs/xfs/xfs_log_recover.c | 2 ++ 3 files changed, 13 insertions(+), 13 deletions(-)
fs/xfs/xfs_buf.c +10 -12
@@ -600,17 +600,15 @@ _xfs_buf_read( xfs_buf_t *bp, xfs_buf_flags_t flags) { - int status; -ASSERT (!(flags &XBF_WRITE ));ASSERT (bp->b_bn !=XFS_BUF_DADDR_NULL ); bp->b_flags &= ~(XBF_WRITE |XBF_ASYNC |XBF_READ_AHEAD ); bp->b_flags |= flags & (XBF_READ |XBF_ASYNC |XBF_READ_AHEAD ); - status =xfs_buf_iorequest (bp); -if (status || bp->b_error || (flags &XBF_ASYNC )) -return status; +xfs_buf_iorequest (bp); +if (flags &XBF_ASYNC ) +return 0 ;return xfs_buf_iowait (bp); }
@@ -695,7 +693,7 @@ xfs_buf_read_uncached(xfsbdstrat (mp, bp); error =xfs_buf_iowait (bp); -if (error || bp->b_error) { +if (error) {xfs_buf_relse (bp);return NULL ; }
@@ -1252,7 +1250,7 @@ next_chunk: } } -int +void xfs_buf_iorequest (xfs_buf_t *bp) {
@@ -1273,13 +1271,12 @@ xfs_buf_iorequest(_xfs_buf_ioend (bp,0 );xfs_buf_rele (bp); -return 0 ; }/* -* Waits for I/O to complete on the buffer supplied. -* It returns immediately if no I/O is pending. -* It returns the I/O error code, if any, or 0 if there was no error. +* Waits for I/O to complete on the buffer supplied. It returns immediately if +* no I/O is pending or there is already a pending error on the buffer. It +* returns the I/O error code, if any, or 0 if there was no error. */ int xfs_buf_iowait(
@@ -1287,7 +1284,8 @@ xfs_buf_iowait( {trace_xfs_buf_iowait (bp, _RET_IP_); -wait_for_completion (&bp->b_iowait); +if (!bp->b_error) +wait_for_completion (&bp->b_iowait);trace_xfs_buf_iowait_done (bp, _RET_IP_);return bp->b_error;
fs/xfs/xfs_buf.h +1 -1
@@ -191,7 +191,7 @@ extern int xfs_bdstrat_cb(struct xfs_buf *);extern void xfs_buf_ioend (xfs_buf_t *,int );extern void xfs_buf_ioerror (xfs_buf_t *,int );extern void xfs_buf_ioerror_alert (struct xfs_buf *,const char *func); -extern int xfs_buf_iorequest (xfs_buf_t *); +extern void xfs_buf_iorequest (xfs_buf_t *);extern int xfs_buf_iowait (xfs_buf_t *);extern void xfs_buf_iomove (xfs_buf_t *,size_t ,size_t ,void *,xfs_buf_rw_t );
fs/xfs/xfs_log_recover.c +2 -0
@@ -179,6 +179,7 @@ xlog_bread_noalign(XFS_BUF_SET_ADDR (bp, log->l_logBBstart + blk_no);XFS_BUF_READ (bp);XFS_BUF_SET_COUNT (bp,BBTOB (nbblks)); + bp->b_error =0 ;xfsbdstrat (log->l_mp, bp); error =xfs_buf_iowait (bp);
@@ -266,6 +267,7 @@ xlog_bwrite(xfs_buf_hold (bp);xfs_buf_lock (bp);XFS_BUF_SET_COUNT (bp,BBTOB (nbblks)); + bp->b_error =0 ; error =xfs_bwrite (bp);if (error)
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 11/37 xfs: pass shutdown method into xfs_trans_ail_delete_bulk
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
xfs_trans_ail_delete_bulk() can be called from different contexts so if the item is not in the AIL we need different shutdown for each context. Pass in the shutdown method needed so the correct action can be taken.
--- fs/xfs/xfs_buf_item.c | 4 ++-- fs/xfs/xfs_dquot.c | 5 +++-- fs/xfs/xfs_dquot_item.c | 2 +- fs/xfs/xfs_extfree_item.c | 3 ++- fs/xfs/xfs_inode.c | 4 ++-- fs/xfs/xfs_inode_item.c | 23 +++++++++++++---------- fs/xfs/xfs_inode_item.h | 2 +- fs/xfs/xfs_log_recover.c | 3 ++- fs/xfs/xfs_sync.c | 2 +- fs/xfs/xfs_trans_ail.c | 5 +++-- fs/xfs/xfs_trans_priv.h | 8 +++++--- 11 files changed, 35 insertions(+), 26 deletions(-)
fs/xfs/xfs_buf_item.c +2 -2
@@ -454,7 +454,7 @@ xfs_buf_item_unpin( bp->b_iodone =NULL ; }else {spin_lock (&ailp->xa_lock); -xfs_trans_ail_delete (ailp, (xfs_log_item_t *)bip); +xfs_trans_ail_delete (ailp, lip,SHUTDOWN_LOG_IO_ERROR );xfs_buf_item_relse (bp);ASSERT (bp->b_fspriv ==NULL ); }
@@ -1006,6 +1006,6 @@ xfs_buf_iodone(* Either way, AIL is useless if we're forcing a shutdown. */ spin_lock (&ailp->xa_lock); -xfs_trans_ail_delete (ailp, lip); +xfs_trans_ail_delete (ailp, lip,SHUTDOWN_CORRUPT_INCORE );xfs_buf_item_free (BUF_ITEM (lip)); }
fs/xfs/xfs_dquot.c +3 -2
@@ -857,7 +857,7 @@ xfs_qm_dqflush_done(/* xfs_trans_ail_delete() drops the AIL lock. */ spin_lock (&ailp->xa_lock);if (lip->li_lsn == qip->qli_flush_lsn) -xfs_trans_ail_delete (ailp, lip); +xfs_trans_ail_delete (ailp, lip,SHUTDOWN_CORRUPT_INCORE );else spin_unlock (&ailp->xa_lock); }
@@ -909,7 +909,8 @@ xfs_qm_dqflush(spin_lock (&mp->m_ail->xa_lock);if (lip->li_flags &XFS_LI_IN_AIL ) -xfs_trans_ail_delete (mp->m_ail, lip); +xfs_trans_ail_delete (mp->m_ail, lip, +SHUTDOWN_CORRUPT_INCORE );else spin_unlock (&mp->m_ail->xa_lock); error =XFS_ERROR (EIO );
fs/xfs/xfs_dquot_item.c +1 -1
@@ -384,7 +384,7 @@ xfs_qm_qoffend_logitem_committed(* xfs_trans_ail_delete() drops the AIL lock. */ spin_lock (&ailp->xa_lock); -xfs_trans_ail_delete (ailp, (xfs_log_item_t *)qfs); +xfs_trans_ail_delete (ailp, &qfs->qql_item,SHUTDOWN_LOG_IO_ERROR );kmem_free (qfs);kmem_free (qfe);
fs/xfs/xfs_extfree_item.c +2 -1
@@ -64,7 +64,8 @@ __xfs_efi_release(if (!test_and_clear_bit (XFS_EFI_COMMITTED , &efip->efi_flags)) {spin_lock (&ailp->xa_lock);/* xfs_trans_ail_delete() drops the AIL lock. */ -xfs_trans_ail_delete (ailp, &efip->efi_item); +xfs_trans_ail_delete (ailp, &efip->efi_item, +SHUTDOWN_LOG_IO_ERROR );xfs_efi_item_free (efip); } }
fs/xfs/xfs_inode.c +2 -2
@@ -2377,7 +2377,7 @@ cluster_corrupt_out:/* * Unlocks the flush lock */ -xfs_iflush_abort (iq); +xfs_iflush_abort (iq, false);kmem_free (ilist);xfs_perag_put (pag);return XFS_ERROR (EFSCORRUPTED );
@@ -2482,7 +2482,7 @@ abort_out:/* * Unlocks the flush lock */ -xfs_iflush_abort (ip); +xfs_iflush_abort (ip, false);return error; }
fs/xfs/xfs_inode_item.c +13 -10
@@ -777,7 +777,8 @@ xfs_iflush_done(ASSERT (i <= need_ail); }/* xfs_trans_ail_delete_bulk() drops the AIL lock. */ -xfs_trans_ail_delete_bulk (ailp, log_items, i); +xfs_trans_ail_delete_bulk (ailp, log_items, i, +SHUTDOWN_CORRUPT_INCORE ); }
@@ -798,16 +799,15 @@ xfs_iflush_done( }/* -* This is the inode flushing abort routine. It is called -* from xfs_iflush when the filesystem is shutting down to clean -* up the inode state. -* It is responsible for removing the inode item -* from the AIL if it has not been re-logged, and unlocking the inode's -* flush lock. +* This is the inode flushing abort routine. It is called from xfs_iflush when +* the filesystem is shutting down to clean up the inode state. It is +* responsible for removing the inode item from the AIL if it has not been +* re-logged, and unlocking the inode's flush lock. */ void xfs_iflush_abort ( -xfs_inode_t *ip) +xfs_inode_t *ip, +bool stale) {xfs_inode_log_item_t *iip = ip->i_itemp;
@@ -817,7 +817,10 @@ xfs_iflush_abort(spin_lock (&ailp->xa_lock);if (iip->ili_item.li_flags &XFS_LI_IN_AIL ) {/* xfs_trans_ail_delete() drops the AIL lock. */ -xfs_trans_ail_delete (ailp, (xfs_log_item_t *)iip); +xfs_trans_ail_delete (ailp, &iip->ili_item, + stale ? +SHUTDOWN_LOG_IO_ERROR : +SHUTDOWN_CORRUPT_INCORE ); }else spin_unlock (&ailp->xa_lock); }
@@ -844,7 +847,7 @@ xfs_istale_done(struct xfs_buf *bp, struct xfs_log_item *lip) { - xfs_iflush_abort(INODE_ITEM(lip)->ili_inode); + xfs_iflush_abort(INODE_ITEM(lip)->ili_inode, true); }/*
fs/xfs/xfs_inode_item.h +1 -1
@@ -165,7 +165,7 @@ extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);extern void xfs_inode_item_destroy (struct xfs_inode *);extern void xfs_iflush_done (struct xfs_buf *,struct xfs_log_item *);extern void xfs_istale_done (struct xfs_buf *,struct xfs_log_item *); -extern void xfs_iflush_abort (struct xfs_inode *); +extern void xfs_iflush_abort (struct xfs_inode *,bool );extern int xfs_inode_item_format_convert (xfs_log_iovec_t *,xfs_inode_log_format_t *);
fs/xfs/xfs_log_recover.c +2 -1
@@ -2645,7 +2645,8 @@ xlog_recover_efd_pass2(* xfs_trans_ail_delete() drops the * AIL lock. */ -xfs_trans_ail_delete (ailp, lip); +xfs_trans_ail_delete (ailp, lip, +SHUTDOWN_CORRUPT_INCORE );xfs_efi_item_free (efip);spin_lock (&ailp->xa_lock);break ;
fs/xfs/xfs_sync.c +1 -1
@@ -684,7 +684,7 @@ restart: goto reclaim;if (XFS_FORCED_SHUTDOWN (ip->i_mount)) {xfs_iunpin_wait (ip); -xfs_iflush_abort (ip); +xfs_iflush_abort (ip, false); goto reclaim; }if (xfs_ipincount (ip)) {
fs/xfs/xfs_trans_ail.c +3 -2
@@ -707,7 +707,8 @@ voidxfs_trans_ail_delete_bulk ( struct xfs_ail *ailp, struct xfs_log_item **log_items, - int nr_items) __releases(ailp->xa_lock) + int nr_items, + int shutdown_type) __releases(ailp->xa_lock) { xfs_log_item_t *mlip;int mlip_changed =0 ;
@@ -725,7 +726,7 @@ xfs_trans_ail_delete_bulk(xfs_alert_tag (mp,XFS_PTAG_AILDELETE ,"%s: attempting to delete a log item that is not in the AIL" , __func__); -xfs_force_shutdown (mp,SHUTDOWN_CORRUPT_INCORE ); +xfs_force_shutdown (mp, shutdown_type); }return ; }
fs/xfs/xfs_trans_priv.h +5 -3
@@ -92,14 +92,16 @@ xfs_trans_ail_update( } void xfs_trans_ail_delete_bulk(struct xfs_ail *ailp, - struct xfs_log_item **log_items, int nr_items) + struct xfs_log_item **log_items, int nr_items, + int shutdown_type) __releases(ailp->xa_lock);static inline void xfs_trans_ail_delete (struct xfs_ail *ailp, - xfs_log_item_t *lip) __releases(ailp->xa_lock) +xfs_log_item_t *lip, + int shutdown_type) __releases(ailp->xa_lock) { -xfs_trans_ail_delete_bulk (ailp, &lip,1 ); +xfs_trans_ail_delete_bulk (ailp, &lip,1 , shutdown_type); }void xfs_ail_push (struct xfs_ail *,xfs_lsn_t );
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 15/37 xfs: fix buffer lookup race on allocation failure
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
When memory allocation fails to add the page array or tht epages to a buffer during xfs_buf_get(), the buffer is left in the cache in a partially initialised state. There is enough state left for the next lookup on that buffer to find the buffer, and for the buffer to then be used without finishing the initialisation. As a result, when an attempt to do IO on the buffer occurs, it fails with EIO because there are no pages attached to the buffer.
We cannot remove the buffer from the cache immediately and free it, because there may already be a racing lookup that is blocked on the buffer lock. Hence the moment we unlock the buffer to then free it, the other user is woken and we have a use-after-free situation.
To avoid this race condition altogether, allocate the pages for the buffer before we insert it into the cache. This then means that we don't have an allocation failure case to deal after the buffer is already present in the cache, and hence avoid the problem altogether. In most cases we won't have racing inserts for the same buffer, and so won't increase the memory pressure allocation before insertion may entail.
--- fs/xfs/xfs_buf.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
fs/xfs/xfs_buf.c +9 -7
@@ -552,18 +552,20 @@ xfs_buf_get(if (unlikely (!new_bp))return NULL ; + error =xfs_buf_allocate_memory (new_bp, flags); +if (error) { +kmem_zone_free (xfs_buf_zone, new_bp); +return NULL ; + } + bp =_xfs_buf_find (target, ioff, isize, flags, new_bp);if (!bp) { -kmem_zone_free (xfs_buf_zone, new_bp); +xfs_buf_free (new_bp);return NULL ; } -if (bp == new_bp) { - error =xfs_buf_allocate_memory (bp, flags); -if (error) - goto no_buffer; - }else -kmem_zone_free (xfs_buf_zone, new_bp); +if (bp != new_bp) +xfs_buf_free (new_bp);/* * Now we have a workable buffer, fill in the block number so
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 14/37 xfs: Use preallocation for inodes with extsz hints
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
xfstest 229 exposes a problem with buffered IO, delayed allocation and extent size hints. That is when we do delayed allocation during buffered IO, we reserve space for the extent size hint alignment and allocate the physical space to align the extent, but we do not zero the regions of the extent that aren't written by the write(2) syscall. The result is that we expose stale data in unwritten regions of the extent size hints.
There are two ways to fix this. The first is to detect that we are doing unaligned writes, check if there is already a mapping or data over the extent size hint range, and if not zero the page cache first before then doing the real write. This can be very expensive for large extent size hints, especially if the subsequent writes fill then entire extent size before the data is written to disk.
The second, and simpler way, is simply to turn off delayed allocation when the extent size hint is set and use preallocation instead. This results in unwritten extents being laid down on disk and so only the written portions will be converted. This matches the behaviour for direct IO, and will also work for the real time device. The disadvantage of this approach is that for small extent size hints we can get file fragmentation, but in general extent size hints are fairly large (e.g. stripe width sized) so this isn't a big deal.
Implement the second approach as it is simple and effective.
--- fs/xfs/xfs_aops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_aops.c +1 -1
@@ -1175,7 +1175,7 @@ __xfs_get_blocks( (!nimaps || (imap.br_startblock == HOLESTARTBLOCK || imap.br_startblock == DELAYSTARTBLOCK))) { -if (direct) { +if (direct ||xfs_get_extsz_hint (ip)) {/* * Drop the ilock in preparation for starting the block * allocation transaction. It will be retaken
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 13/37 xfs: page type check in writeback only checks last buffer
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
xfs_is_delayed_page() checks to see if a page has buffers matching the given IO type passed in. It does so by walking the buffer heads on the page and checking if the state flags match the IO type.
However, the "acceptable" variable that is calculated is overwritten every time a new buffer is checked. Hence if the first buffer on the page is of the right type, this state is lost if the second buffer is not of the correct type. This means that xfs_aops_discard_page() may not discard delalloc regions when it is supposed to, and xfs_convert_page() may not cluster IO as efficiently as possible.
This problem only occurs on filesystems with a block size smaller than page size.
Also, rename xfs_is_delayed_page() to xfs_check_page_type() to better describe what it is doing - it is not delalloc specific anymore.
The problem was first noticed by Peter Watkins.
--- fs/xfs/xfs_aops.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
fs/xfs/xfs_aops.c +6 -6
@@ -623,7 +623,7 @@ xfs_map_at_offset(* or delayed allocate extent. */ STATIC int -xfs_is_delayed_page ( +xfs_check_page_type (struct page *page,unsigned int type) {
@@ -637,11 +637,11 @@ xfs_is_delayed_page( bh = head =page_buffers (page);do {if (buffer_unwritten (bh)) - acceptable = (type ==IO_UNWRITTEN ); + acceptable += (type ==IO_UNWRITTEN );else if (buffer_delay (bh)) - acceptable = (type ==IO_DELALLOC ); + acceptable += (type ==IO_DELALLOC );else if (buffer_dirty (bh) &&buffer_mapped (bh)) - acceptable = (type ==IO_OVERWRITE ); + acceptable += (type ==IO_OVERWRITE );else break ; }while ((bh = bh->b_this_page) != head);
@@ -684,7 +684,7 @@ xfs_convert_page( goto fail_unlock_page;if (page->mapping != inode->i_mapping) goto fail_unlock_page; -if (!xfs_is_delayed_page (page, (*ioendp)->io_type)) +if (!xfs_check_page_type (page, (*ioendp)->io_type)) goto fail_unlock_page;/*
@@ -834,7 +834,7 @@ xfs_aops_discard_page(struct buffer_head *bh, *head;loff_t offset =page_offset (page); -if (!xfs_is_delayed_page (page,IO_DELALLOC )) +if (!xfs_check_page_type (page,IO_DELALLOC )) goto out_invalidate;if (XFS_FORCED_SHUTDOWN (ip->i_mount))
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 20/37 xfs: kill b_file_offset
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Seeing as we pass block numbers around everywhere in the buffer cache now, it makes no sense to index everything by byte offset. Replace all the byte offset indexing with block number based indexing, and replace all uses of the byte offset with direct conversion from the block index.
--- fs/xfs/xfs_buf.c | 17 +++++++---------- fs/xfs/xfs_buf.h | 5 +---- 2 files changed, 8 insertions(+), 14 deletions(-)
fs/xfs/xfs_buf.c +7 -10
@@ -196,7 +196,7 @@ xfs_buf_alloc(sema_init (&bp->b_sema,0 );/* held, no waiters */ XB_SET_OWNER (bp); bp->b_target = target; - bp->b_file_offset = blkno <<BBSHIFT ; +/* * Set buffer_length and count_desired to the same value initially. * I/O routines should use count_desired, which will be the same in
@@ -337,8 +337,8 @@ xfs_buf_allocate_memory( } use_alloc_page: - end = bp->b_file_offset + bp->b_buffer_length; - page_count =xfs_buf_btoc (end) -xfs_buf_btoct (bp->b_file_offset); + end =BBTOB (bp->b_bn) + bp->b_buffer_length; + page_count =xfs_buf_btoc (end) -xfs_buf_btoct (BBTOB (bp->b_bn)); error =_xfs_buf_get_pages (bp, page_count, flags);if (unlikely (error))return error;
@@ -439,19 +439,17 @@ _xfs_buf_find(xfs_buf_flags_t flags, xfs_buf_t *new_bp) { - xfs_off_t offset; size_t numbytes;struct xfs_perag *pag;struct rb_node **rbp;struct rb_node *parent;xfs_buf_t *bp; - offset =BBTOB (blkno); numbytes =BBTOB (numblks);/* Check for IOs smaller than the sector size / not sector aligned */ ASSERT (!(numbytes < (1 << btp->bt_sshift))); -ASSERT (!(offset & (xfs_off_t )btp->bt_smask)); +ASSERT (!(BBTOB (blkno) & (xfs_off_t )btp->bt_smask));/* get tree root */ pag = xfs_perag_get(btp->bt_mount,
@@ -466,13 +464,13 @@ _xfs_buf_find( parent = *rbp; bp = rb_entry(parent, struct xfs_buf, b_rbnode); -if (offset < bp->b_file_offset) +if (blkno < bp->b_bn) rbp = &(*rbp)->rb_left; -else if (offset > bp->b_file_offset) +else if (blkno > bp->b_bn) rbp = &(*rbp)->rb_right;else {/* -* found a block offset match. If the range doesn't +* found a block number match. If the range doesn't * match, the only way this is allowed is if the buffer * in the cache is stale and the transaction that made * it stale has not yet committed. i.e. we are
@@ -718,7 +716,6 @@ xfs_buf_set_empty( bp->b_pages =NULL ; bp->b_page_count =0 ; bp->b_addr =NULL ; - bp->b_file_offset =0 ; bp->b_buffer_length = bp->b_count_desired = numblks <<BBSHIFT ; bp->b_bn =XFS_BUF_DADDR_NULL ; bp->b_flags &= ~XBF_MAPPED ;
fs/xfs/xfs_buf.h +1 -4
@@ -116,7 +116,7 @@ typedef struct xfs_buf {* fast-path on locking. */ struct rb_node b_rbnode;/* rbtree node */ -xfs_off_t b_file_offset;/* offset in file */ +xfs_daddr_t b_bn;/* block number for I/O */ size_t b_buffer_length;/* size of buffer in bytes */ atomic_t b_hold;/* reference count */ atomic_t b_lru_ref;/* lru reclaim ref count */
@@ -128,7 +128,6 @@ typedef struct xfs_buf {struct list_head b_list;struct xfs_perag *b_pag;/* contains rbtree root */ xfs_buftarg_t *b_target;/* buffer target (device) */ -xfs_daddr_t b_bn;/* block number for I/O */ size_t b_count_desired;/* desired transfer size */ void *b_addr;/* virtual address of buffer */ struct work_struct b_iodone_work;
@@ -245,8 +244,6 @@ void xfs_buf_stale(struct xfs_buf *bp);#define XFS_BUF_ADDR (bp) ((bp)->b_bn)#define XFS_BUF_SET_ADDR (bp, bno) ((bp)->b_bn = (xfs_daddr_t)(bno)) -#define XFS_BUF_OFFSET (bp) ((bp)->b_file_offset) -#define XFS_BUF_SET_OFFSET (bp, off) ((bp)->b_file_offset = (off))#define XFS_BUF_COUNT (bp) ((bp)->b_count_desired)#define XFS_BUF_SET_COUNT (bp, cnt) ((bp)->b_count_desired = (cnt))#define XFS_BUF_SIZE (bp) ((bp)->b_buffer_length)
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 21/37 xfs: use blocks for counting length of buffers
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Now that we pass block counts everywhere, and index buffers by block number, track the length of the buffer in units of blocks rather than bytes. Convert the code to use block counts, and those that need byte counts get converted at the time of use.
Also, remove the XFS_BUF_{SET_}SIZE() macros that are just wrappers around the buffer length. They onyl serve to make the code shouty loud and don't actually add any real value.
--- fs/xfs/xfs_attr.c | 15 +++++++++------ fs/xfs/xfs_buf.c | 22 ++++++++++++---------- fs/xfs/xfs_buf.h | 4 +--- fs/xfs/xfs_log.c | 5 +---- fs/xfs/xfs_log_recover.c | 8 ++++---- fs/xfs/xfs_trace.h | 14 +++++++------- 6 files changed, 34 insertions(+), 34 deletions(-)
fs/xfs/xfs_attr.c +9 -6
@@ -1993,8 +1993,7 @@ xfs_attr_rmtval_get(xfs_da_args_t *args)if (error)return (error); - tmp = (valuelen <XFS_BUF_SIZE (bp)) - ? valuelen :XFS_BUF_SIZE (bp); + tmp =min_t (int, valuelen,BBTOB (bp->b_length));xfs_buf_iomove (bp,0 , tmp, dst,XBRW_READ );xfs_buf_relse (bp); dst += tmp;
@@ -2097,6 +2096,8 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) lblkno = args->rmtblkno; valuelen = args->valuelen;while (valuelen >0 ) { +int buflen; +/* * Try to remember where we decided to put the value. */
@@ -2118,11 +2119,13 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) XBF_LOCK | XBF_DONT_BLOCK);if (!bp)return ENOMEM ; - tmp = (valuelen <XFS_BUF_SIZE (bp)) ? valuelen : -XFS_BUF_SIZE (bp); + + buflen =BBTOB (bp->b_length); + tmp =min_t (int, valuelen, buflen);xfs_buf_iomove (bp,0 , tmp, src,XBRW_WRITE ); -if (tmp <XFS_BUF_SIZE (bp)) -xfs_buf_zero (bp, tmp,XFS_BUF_SIZE (bp) - tmp); +if (tmp < buflen) +xfs_buf_zero (bp, tmp, buflen - tmp); + error =xfs_bwrite (bp);/* GROT: NOTE: synchronous write */ xfs_buf_relse (bp);if (error)
fs/xfs/xfs_buf.c +12 -10
@@ -198,11 +198,12 @@ xfs_buf_alloc( bp->b_target = target;/* -* Set buffer_length and count_desired to the same value initially. +* Set length and count_desired to the same value initially. * I/O routines should use count_desired, which will be the same in * most cases but may be reset (e.g. XFS recovery). */ - bp->b_buffer_length = bp->b_count_desired = numblks <<BBSHIFT ; + bp->b_length = numblks; + bp->b_count_desired = numblks <<BBSHIFT ; bp->b_flags = flags;/*
@@ -313,14 +314,14 @@ xfs_buf_allocate_memory(* the memory from the heap - there's no need for the complexity of * page arrays to keep allocation down to order 0. */ -if (bp->b_buffer_length <PAGE_SIZE ) { - bp->b_addr =kmem_alloc (bp->b_buffer_length,xb_to_km (flags)); +if (bp->b_length <BTOBB (PAGE_SIZE )) { + bp->b_addr =kmem_alloc (BBTOB (bp->b_length),xb_to_km (flags));if (!bp->b_addr) {/* low memory - use alloc_page loop instead */ goto use_alloc_page; } -if (((unsigned long )(bp->b_addr + bp->b_buffer_length -1 ) & +if (((unsigned long )(bp->b_addr +BBTOB (bp->b_length) -1 ) &PAGE_MASK ) != ((unsigned long )bp->b_addr &PAGE_MASK )) {/* b_addr spans two pages - use alloc_page instead */
@@ -337,7 +338,7 @@ xfs_buf_allocate_memory( } use_alloc_page: - end =BBTOB (bp->b_bn) + bp->b_buffer_length; + end =BBTOB (bp->b_bn + bp->b_length); page_count =xfs_buf_btoc (end) -xfs_buf_btoct (BBTOB (bp->b_bn)); error =_xfs_buf_get_pages (bp, page_count, flags);if (unlikely (error))
@@ -477,7 +478,7 @@ _xfs_buf_find(* reallocating a busy extent. Skip this buffer and * continue searching to the right for an exact match. */ -if (bp->b_buffer_length != numbytes) { +if (bp->b_length != numblks) {ASSERT (bp->b_flags &XBF_STALE ); rbp = &(*rbp)->rb_right;continue ;
@@ -574,7 +575,7 @@ xfs_buf_get(* that we can do IO on it. */ bp->b_bn = blkno; - bp->b_count_desired = bp->b_buffer_length; + bp->b_count_desired =BBTOB (bp->b_length); found:if (!(bp->b_flags &XBF_MAPPED )) {
@@ -716,7 +717,8 @@ xfs_buf_set_empty( bp->b_pages =NULL ; bp->b_page_count =0 ; bp->b_addr =NULL ; - bp->b_buffer_length = bp->b_count_desired = numblks <<BBSHIFT ; + bp->b_length = numblks; + bp->b_count_desired = numblks <<BBSHIFT ; bp->b_bn =XFS_BUF_DADDR_NULL ; bp->b_flags &= ~XBF_MAPPED ; }
@@ -769,7 +771,7 @@ xfs_buf_associate_memory( } bp->b_count_desired = len; - bp->b_buffer_length = buflen; + bp->b_length =BTOBB (buflen); bp->b_flags |=XBF_MAPPED ;return 0 ;
fs/xfs/xfs_buf.h +1 -3
@@ -117,7 +117,7 @@ typedef struct xfs_buf {*/ struct rb_node b_rbnode;/* rbtree node */ xfs_daddr_t b_bn;/* block number for I/O */ -size_t b_buffer_length;/* size of buffer in bytes */ +int b_length;/* size of buffer in BBs */ atomic_t b_hold;/* reference count */ atomic_t b_lru_ref;/* lru reclaim ref count */ xfs_buf_flags_t b_flags;/* status flags */
@@ -246,8 +246,6 @@ void xfs_buf_stale(struct xfs_buf *bp);#define XFS_BUF_SET_ADDR (bp, bno) ((bp)->b_bn = (xfs_daddr_t)(bno))#define XFS_BUF_COUNT (bp) ((bp)->b_count_desired)#define XFS_BUF_SET_COUNT (bp, cnt) ((bp)->b_count_desired = (cnt)) -#define XFS_BUF_SIZE (bp) ((bp)->b_buffer_length) -#define XFS_BUF_SET_SIZE (bp, cnt) ((bp)->b_buffer_length = (cnt))static inline void xfs_buf_set_ref (struct xfs_buf *bp,int lru_ref) {
fs/xfs/xfs_log.c +1 -4
@@ -1197,9 +1197,6 @@ xlog_alloc_log(xfs_mount_t *mp,spin_lock_init (&log->l_icloglock);init_waitqueue_head (&log->l_flush_wait); -/* log record size must be multiple of BBSIZE; see xlog_rec_header_t */ -ASSERT ((XFS_BUF_SIZE (bp) &BBMASK ) ==0 ); - iclogp = &log->l_iclog;/* * The amount of memory to allocate for the iclog structure is
@@ -1239,7 +1236,7 @@ xlog_alloc_log(xfs_mount_t *mp, head->h_fmt =cpu_to_be32 (XLOG_FMT );memcpy (&head->h_fs_uuid, &mp->m_sb.sb_uuid,sizeof (uuid_t)); - iclog->ic_size =XFS_BUF_SIZE (bp) - log->l_iclog_hsize; + iclog->ic_size =BBTOB (bp->b_length) - log->l_iclog_hsize; iclog->ic_state =XLOG_STATE_ACTIVE ; iclog->ic_log = log;atomic_set (&iclog->ic_refcnt,0 );
fs/xfs/xfs_log_recover.c +4 -4
@@ -146,7 +146,7 @@ xlog_align( {xfs_daddr_t offset = blk_no & ((xfs_daddr_t )log->l_sectBBsize -1 ); -ASSERT (BBTOB (offset + nbblks) <=XFS_BUF_SIZE (bp)); +ASSERT (offset + nbblks <= bp->b_length);return bp->b_addr +BBTOB (offset); }
@@ -174,7 +174,7 @@ xlog_bread_noalign( nbblks =round_up (nbblks, log->l_sectBBsize);ASSERT (nbblks >0 ); -ASSERT (BBTOB (nbblks) <=XFS_BUF_SIZE (bp)); +ASSERT (nbblks <= bp->b_length);XFS_BUF_SET_ADDR (bp, log->l_logBBstart + blk_no);XFS_BUF_READ (bp);
@@ -219,7 +219,7 @@ xlog_bread_offset( xfs_caddr_t offset) {xfs_caddr_t orig_offset = bp->b_addr; -int orig_len = bp->b_buffer_length; +int orig_len =BBTOB (bp->b_length);int error, error2; error =xfs_buf_associate_memory (bp, offset,BBTOB (nbblks));
@@ -260,7 +260,7 @@ xlog_bwrite( nbblks =round_up (nbblks, log->l_sectBBsize);ASSERT (nbblks >0 ); -ASSERT (BBTOB (nbblks) <=XFS_BUF_SIZE (bp)); +ASSERT (nbblks <= bp->b_length);XFS_BUF_SET_ADDR (bp, log->l_logBBstart + blk_no);XFS_BUF_ZEROFLAGS (bp);
fs/xfs/xfs_trace.h +7 -7
@@ -281,7 +281,7 @@ DECLARE_EVENT_CLASS(xfs_buf_class,TP_STRUCT__entry (__field (dev_t ,dev )__field (xfs_daddr_t, bno) -__field (size_t, buffer_length) +__field (int, nblks)__field (int, hold)__field (int, pincount) __field(unsigned, lockval)
@@ -291,18 +291,18 @@ DECLARE_EVENT_CLASS(xfs_buf_class,TP_fast_assign ( __entry->dev = bp->b_target->bt_dev; __entry->bno = bp->b_bn; - __entry->buffer_length = bp->b_buffer_length; + __entry->nblks = bp->b_length; __entry->hold =atomic_read (&bp->b_hold); __entry->pincount =atomic_read (&bp->b_pin_count); __entry->lockval = bp->b_sema.count; __entry->flags = bp->b_flags; __entry->caller_ip = caller_ip; ), - TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " + TP_printk("dev %d:%d bno 0x%llx nblks 0x%x hold %d pincount %d " "lock %d flags %s caller %pf", MAJOR(__entry->dev), MINOR(__entry->dev), (unsigned long long)__entry->bno, - __entry->buffer_length, + __entry->nblks, __entry->hold, __entry->pincount, __entry->lockval,
@@ -362,7 +362,7 @@ DECLARE_EVENT_CLASS(xfs_buf_flags_class,TP_fast_assign ( __entry->dev = bp->b_target->bt_dev; __entry->bno = bp->b_bn; - __entry->buffer_length = bp->b_buffer_length; + __entry->buffer_length =BBTOB (bp->b_length); __entry->flags = flags; __entry->hold =atomic_read (&bp->b_hold); __entry->pincount =atomic_read (&bp->b_pin_count);
@@ -406,7 +406,7 @@ TRACE_EVENT(xfs_buf_ioerror,TP_fast_assign ( __entry->dev = bp->b_target->bt_dev; __entry->bno = bp->b_bn; - __entry->buffer_length = bp->b_buffer_length; + __entry->buffer_length =BBTOB (bp->b_length); __entry->hold =atomic_read (&bp->b_hold); __entry->pincount =atomic_read (&bp->b_pin_count); __entry->lockval = bp->b_sema.count;
@@ -450,7 +450,7 @@ DECLARE_EVENT_CLASS(xfs_buf_item_class, __entry->bli_recur = bip->bli_recur; __entry->bli_refcount =atomic_read (&bip->bli_refcount); __entry->buf_bno = bip->bli_buf->b_bn; - __entry->buf_len = bip->bli_buf->b_buffer_length; + __entry->buf_len =BBTOB (bip->bli_buf->b_length); __entry->buf_flags = bip->bli_buf->b_flags; __entry->buf_hold =atomic_read (&bip->bli_buf->b_hold); __entry->buf_pincount =atomic_read (&bip->bli_buf->b_pin_count);
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 23/37 xfs: kill xfs_buf_btoc
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
xfs_buf_btoc and friends are simple macros that do basic block to page index conversion and vice versa. These aren't widely used, and we use open coded masking and shifting everywhere else. Hence remove themacros and open code the work they do.
Also, use of PAGE_CACHE_{SIZE|SHIFT|MASK} for these macros is now incorrect - we are using pages directly and not the page cache, so use PAGE_{SIZE|MASK|SHIFT} instead.
--- fs/xfs/xfs_buf.c | 39 +++++++++++++++++++++------------------ fs/xfs/xfs_buf.h | 5 ----- 2 files changed, 21 insertions(+), 23 deletions(-)
fs/xfs/xfs_buf.c +21 -18
@@ -306,7 +306,7 @@ xfs_buf_allocate_memory(size_t nbytes, offset;gfp_t gfp_mask =xb_to_gfp (flags);unsigned short page_count, i; -xfs_off_t end; +xfs_off_t start, end;int error;/*
@@ -314,15 +314,15 @@ xfs_buf_allocate_memory(* the memory from the heap - there's no need for the complexity of * page arrays to keep allocation down to order 0. */ -if (bp->b_length <BTOBB (PAGE_SIZE )) { - bp->b_addr =kmem_alloc (BBTOB (bp->b_length),xb_to_km (flags)); + size =BBTOB (bp->b_length); +if (size <PAGE_SIZE ) { + bp->b_addr =kmem_alloc (size,xb_to_km (flags));if (!bp->b_addr) {/* low memory - use alloc_page loop instead */ goto use_alloc_page; } -if (((unsigned long )(bp->b_addr +BBTOB (bp->b_length) -1 ) & -PAGE_MASK ) != +if (((unsigned long )(bp->b_addr + size -1 ) &PAGE_MASK ) != ((unsigned long )bp->b_addr &PAGE_MASK )) {/* b_addr spans two pages - use alloc_page instead */ kmem_free (bp->b_addr);
@@ -338,14 +338,14 @@ xfs_buf_allocate_memory( } use_alloc_page: - end =BBTOB (bp->b_bn + bp->b_length); - page_count =xfs_buf_btoc (end) -xfs_buf_btoct (BBTOB (bp->b_bn)); + start =BBTOB (bp->b_bn) >>PAGE_SHIFT ; + end = (BBTOB (bp->b_bn + bp->b_length) +PAGE_SIZE -1 ) >>PAGE_SHIFT ; + page_count = end - start; error =_xfs_buf_get_pages (bp, page_count, flags);if (unlikely (error))return error; offset = bp->b_offset; - size =BBTOB (bp->b_length); bp->b_flags |= _XBF_PAGES;for (i =0 ; i < bp->b_page_count; i++) {
@@ -1320,27 +1320,30 @@ xfs_buf_iomove(void *data,/* data address */ xfs_buf_rw_t mode) /* read/write/zero flag */ { - size_t bend, cpoff, csize; -struct page *page; + size_t bend; bend = boff + bsize;while (boff < bend) { - page = bp->b_pages[xfs_buf_btoct (boff + bp->b_offset)]; - cpoff =xfs_buf_poff (boff + bp->b_offset); - csize =min_t (size_t, -PAGE_SIZE - cpoff,BBTOB (bp->b_io_length) - boff); +struct page *page; +int page_index, page_offset, csize; + + page_index = (boff + bp->b_offset) >>PAGE_SHIFT ; + page_offset = (boff + bp->b_offset) & ~PAGE_MASK ; + page = bp->b_pages[page_index]; + csize =min_t (size_t,PAGE_SIZE - page_offset, +BBTOB (bp->b_io_length) - boff); -ASSERT (((csize + cpoff) <=PAGE_SIZE )); +ASSERT ((csize + page_offset) <=PAGE_SIZE );switch (mode) {case XBRW_ZERO : -memset (page_address (page) + cpoff,0 , csize); +memset (page_address (page) + page_offset,0 , csize);break ;case XBRW_READ : -memcpy (data,page_address (page) + cpoff, csize); +memcpy (data,page_address (page) + page_offset, csize);break ;case XBRW_WRITE : -memcpy (page_address (page) + cpoff, data, csize); +memcpy (page_address (page) + page_offset, data, csize); } boff += csize;
fs/xfs/xfs_buf.h +0 -5
@@ -32,11 +32,6 @@#define XFS_BUF_DADDR_NULL ((xfs_daddr_t) (-1LL)) -#define xfs_buf_ctob (pp) ((pp) * PAGE_CACHE_SIZE) -#define xfs_buf_btoc (dd) (((dd) + PAGE_CACHE_SIZE-1) >> PAGE_CACHE_SHIFT) -#define xfs_buf_btoct (dd) ((dd) >> PAGE_CACHE_SHIFT) -#define xfs_buf_poff (aa) ((aa) & ~PAGE_CACHE_MASK) - typedef enum { XBRW_READ = 1, /* transfer into target memory */ XBRW_WRITE = 2, /* transfer from target memory */
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 22/37 xfs: use blocks for storing the desired IO size
In reply to Dave ChinnerNow that we pass block counts everywhere, and index buffers by block number and length in units of blocks, convert the desired IO size into block counts rather than bytes. Convert the code to use block counts, and those that need byte counts get converted at the time of use.
Rename the b_desired_count variable to something closer to it's purpose - b_io_length - as it is only used to specify the length of an IO for a subset of the buffer. The only time this is used is for log IO - both writing iclogs and during log recovery. In all other cases, the b_io_length matches b_length, and hence a lot of code confuses the two. e.g. the buf item code uses the io count exclusively when it should be using the buffer length. Fix these apprpriately as they are found.
Also, remove the XFS_BUF_{SET_}COUNT() macros that are just wrappers around the desired IO length. They only serve to make the code shouty loud, don't actually add any real value, and are often used incorrectly.
--- fs/xfs/xfs_buf.c | 26 +++++++++++++------------- fs/xfs/xfs_buf.h | 4 +--- fs/xfs/xfs_buf_item.c | 15 ++++++++------- fs/xfs/xfs_da_btree.c | 16 ++++++++-------- fs/xfs/xfs_log.c | 2 +- fs/xfs/xfs_log_recover.c | 15 ++++++++------- fs/xfs/xfs_trans_buf.c | 4 ++-- 7 files changed, 41 insertions(+), 41 deletions(-)
fs/xfs/xfs_buf.c +13 -13
@@ -198,12 +198,12 @@ xfs_buf_alloc( bp->b_target = target;/* -* Set length and count_desired to the same value initially. -* I/O routines should use count_desired, which will be the same in +* Set length and io_length to the same value initially. +* I/O routines should use io_length, which will be the same in * most cases but may be reset (e.g. XFS recovery). */ bp->b_length = numblks; - bp->b_count_desired = numblks <<BBSHIFT ; + bp->b_io_length = numblks; bp->b_flags = flags;/*
@@ -302,7 +302,7 @@ xfs_buf_allocate_memory(xfs_buf_t *bp, uint flags) { - size_t size = bp->b_count_desired; + size_t size;size_t nbytes, offset;gfp_t gfp_mask =xb_to_gfp (flags);unsigned short page_count, i;
@@ -345,6 +345,7 @@ use_alloc_page:return error; offset = bp->b_offset; + size =BBTOB (bp->b_length); bp->b_flags |= _XBF_PAGES;for (i =0 ; i < bp->b_page_count; i++) {
@@ -575,7 +576,7 @@ xfs_buf_get(* that we can do IO on it. */ bp->b_bn = blkno; - bp->b_count_desired =BBTOB (bp->b_length); + bp->b_io_length = bp->b_length; found:if (!(bp->b_flags &XBF_MAPPED )) {
@@ -718,7 +719,7 @@ xfs_buf_set_empty( bp->b_page_count =0 ; bp->b_addr =NULL ; bp->b_length = numblks; - bp->b_count_desired = numblks <<BBSHIFT ; + bp->b_io_length = numblks; bp->b_bn =XFS_BUF_DADDR_NULL ; bp->b_flags &= ~XBF_MAPPED ; }
@@ -770,7 +771,7 @@ xfs_buf_associate_memory( pageaddr +=PAGE_SIZE ; } - bp->b_count_desired = len; + bp->b_io_length =BTOBB (len); bp->b_length =BTOBB (buflen); bp->b_flags |=XBF_MAPPED ;
@@ -1012,9 +1013,8 @@ xfs_buf_ioerror_alert( const char *func) {xfs_alert (bp->b_target->bt_mount, -"metadata I/O error: block 0x%llx (\"%s\") error %d buf count %zd" , - (__uint64_t )XFS_BUF_ADDR (bp), func, - bp->b_error,XFS_BUF_COUNT (bp)); +"metadata I/O error: block 0x%llx (\"%s\") error %d numblks %d" , + (__uint64_t )XFS_BUF_ADDR (bp), func, bp->b_error, bp->b_length); }int
@@ -1186,7 +1186,7 @@ _xfs_buf_ioapply(int rw, map_i, total_nr_pages, nr_pages;struct bio *bio;int offset = bp->b_offset; -int size = bp->b_count_desired; +int size =BBTOB (bp->b_io_length);sector_t sector = bp->b_bn; total_nr_pages = bp->b_page_count;
@@ -1234,7 +1234,7 @@ next_chunk:break ; offset =0 ; - sector += nbytes >>BBSHIFT ; + sector +=BTOBB (nbytes); size -= nbytes; total_nr_pages--; }
@@ -1328,7 +1328,7 @@ xfs_buf_iomove( page = bp->b_pages[xfs_buf_btoct (boff + bp->b_offset)]; cpoff =xfs_buf_poff (boff + bp->b_offset); csize =min_t (size_t, -PAGE_SIZE -cpoff, bp->b_count_desired-boff); +PAGE_SIZE - cpoff,BBTOB (bp->b_io_length) - boff);ASSERT (((csize + cpoff) <=PAGE_SIZE ));
fs/xfs/xfs_buf.h +1 -3
@@ -128,7 +128,6 @@ typedef struct xfs_buf {struct list_head b_list;struct xfs_perag *b_pag;/* contains rbtree root */ xfs_buftarg_t *b_target;/* buffer target (device) */ -size_t b_count_desired;/* desired transfer size */ void *b_addr;/* virtual address of buffer */ struct work_struct b_iodone_work;xfs_buf_iodone_t b_iodone;/* I/O completion function */
@@ -137,6 +136,7 @@ typedef struct xfs_buf {struct xfs_trans *b_transp;struct page **b_pages;/* array of page pointers */ struct page *b_page_array[XB_PAGES ];/* inline pages */ +int b_io_length;/* IO size in BBs */ atomic_t b_pin_count;/* pin count */ atomic_t b_io_remaining;/* #outstanding I/O requests */ unsigned int b_page_count;/* size of page array */
@@ -244,8 +244,6 @@ void xfs_buf_stale(struct xfs_buf *bp);#define XFS_BUF_ADDR (bp) ((bp)->b_bn)#define XFS_BUF_SET_ADDR (bp, bno) ((bp)->b_bn = (xfs_daddr_t)(bno)) -#define XFS_BUF_COUNT (bp) ((bp)->b_count_desired) -#define XFS_BUF_SET_COUNT (bp, cnt) ((bp)->b_count_desired = (cnt))static inline void xfs_buf_set_ref (struct xfs_buf *bp,int lru_ref) {
fs/xfs/xfs_buf_item.c +8 -7
@@ -123,11 +123,11 @@ xfs_buf_item_log_check(ASSERT (bip->bli_logged !=NULL ); bp = bip->bli_buf; -ASSERT (XFS_BUF_COUNT (bp) >0 ); +ASSERT (bp->b_length >0 );ASSERT (bp->b_addr !=NULL ); orig = bip->bli_orig; buffer = bp->b_addr; -for (x =0 ; x <XFS_BUF_COUNT (bp); x++) { +for (x =0 ; x <BBTOB (bp->b_length); x++) {if (orig[x] != buffer[x] && !btst (bip->bli_logged, x)) { xfs_emerg(bp->b_mount, "%s: bip %x buffer %x orig %x index %d",
@@ -657,7 +657,8 @@ xfs_buf_item_init(* truncate any pieces. map_size is the size of the * bitmap needed to describe the chunks of the buffer. */ - chunks = (int )((XFS_BUF_COUNT (bp) + (XFS_BLF_CHUNK -1 )) >>XFS_BLF_SHIFT ); + chunks = (int )((BBTOB (bp->b_length) + (XFS_BLF_CHUNK -1 )) >> +XFS_BLF_SHIFT ); map_size = (int )((chunks +NBWORD ) >>BIT_TO_WORD_SHIFT ); bip = (xfs_buf_log_item_t*)kmem_zone_zalloc(xfs_buf_item_zone,
@@ -667,7 +668,7 @@ xfs_buf_item_init(xfs_buf_hold (bp); bip->bli_format.blf_type =XFS_LI_BUF ; bip->bli_format.blf_blkno = (__int64_t )XFS_BUF_ADDR (bp); - bip->bli_format.blf_len = (ushort )BTOBB (XFS_BUF_COUNT (bp)); + bip->bli_format.blf_len = (ushort )bp->b_length; bip->bli_format.blf_map_size = map_size;#ifdef XFS_TRANS_DEBUG
@@ -679,9 +680,9 @@ xfs_buf_item_init(* the buffer to indicate which bytes the callers have asked * to have logged. */ - bip->bli_orig = (char *)kmem_alloc (XFS_BUF_COUNT (bp),KM_SLEEP ); -memcpy (bip->bli_orig, bp->b_addr,XFS_BUF_COUNT (bp)); - bip->bli_logged = (char *)kmem_zalloc (XFS_BUF_COUNT (bp) /NBBY ,KM_SLEEP ); + bip->bli_orig =kmem_alloc (BBTOB (bp->b_length),KM_SLEEP ); +memcpy (bip->bli_orig, bp->b_addr,BBTOB (bp->b_length)); + bip->bli_logged =kmem_zalloc (BBTOB (bp->b_length) /NBBY ,KM_SLEEP );#endif /*
fs/xfs/xfs_da_btree.c +8 -8
@@ -2277,20 +2277,20 @@ xfs_da_buf_make(int nbuf, xfs_buf_t **bps)if (nbuf ==1 ) { dabuf->nbuf =1 ; bp = bps[0 ]; - dabuf->bbcount = (short )BTOBB (XFS_BUF_COUNT (bp)); + dabuf->bbcount = bp->b_length; dabuf->data = bp->b_addr; dabuf->bps[0 ] = bp; }else { dabuf->nbuf = nbuf;for (i =0 , dabuf->bbcount =0 ; i < nbuf; i++) { dabuf->bps[i] = bp = bps[i]; - dabuf->bbcount +=BTOBB (XFS_BUF_COUNT (bp)); + dabuf->bbcount += bp->b_length; } dabuf->data =kmem_alloc (BBTOB (dabuf->bbcount),KM_SLEEP ); -for (i = off =0 ; i < nbuf; i++, off +=XFS_BUF_COUNT (bp)) { +for (i = off =0 ; i < nbuf; i++, off +=BBTOB (bp->b_length)) { bp = bps[i];memcpy ((char *)dabuf->data + off, bp->b_addr, -XFS_BUF_COUNT (bp)); +BBTOB (bp->b_length)); } }return dabuf;
@@ -2310,10 +2310,10 @@ xfs_da_buf_clean(xfs_dabuf_t *dabuf)ASSERT (dabuf->nbuf >1 ); dabuf->dirty =0 ;for (i = off =0 ; i < dabuf->nbuf; - i++, off +=XFS_BUF_COUNT (bp)) { + i++, off +=BBTOB (bp->b_length)) { bp = dabuf->bps[i];memcpy (bp->b_addr, dabuf->data + off, -XFS_BUF_COUNT (bp)); +BBTOB (bp->b_length)); } } }
@@ -2356,10 +2356,10 @@ xfs_da_log_buf(xfs_trans_t *tp, xfs_dabuf_t *dabuf, uint first, uint last) } dabuf->dirty =1 ;ASSERT (first <= last); -for (i = off =0 ; i < dabuf->nbuf; i++, off +=XFS_BUF_COUNT (bp)) { +for (i = off =0 ; i < dabuf->nbuf; i++, off +=BBTOB (bp->b_length)) { bp = dabuf->bps[i]; f = off; - l = f +XFS_BUF_COUNT (bp) -1 ; + l = f +BBTOB (bp->b_length) -1 ;if (f < first) f = first;if (l > last)
fs/xfs/xfs_log.c +1 -1
@@ -1487,7 +1487,7 @@ xlog_sync(xlog_t *log, }else { iclog->ic_bwritecnt =1 ; } -XFS_BUF_SET_COUNT (bp, count); + bp->b_io_length =BTOBB (count); bp->b_fspriv = iclog;XFS_BUF_ZEROFLAGS (bp);XFS_BUF_ASYNC (bp);
fs/xfs/xfs_log_recover.c +8 -7
@@ -178,7 +178,7 @@ xlog_bread_noalign(XFS_BUF_SET_ADDR (bp, log->l_logBBstart + blk_no);XFS_BUF_READ (bp); -XFS_BUF_SET_COUNT (bp,BBTOB (nbblks)); + bp->b_io_length = nbblks; bp->b_error =0 ;xfsbdstrat (log->l_mp, bp);
@@ -266,7 +266,7 @@ xlog_bwrite(XFS_BUF_ZEROFLAGS (bp);xfs_buf_hold (bp);xfs_buf_lock (bp); -XFS_BUF_SET_COUNT (bp,BBTOB (nbblks)); + bp->b_io_length = nbblks; bp->b_error =0 ; error =xfs_bwrite (bp);
@@ -1774,7 +1774,7 @@ xlog_recover_do_inode_buffer(trace_xfs_log_recover_buf_inode_buf (mp->m_log, buf_f); - inodes_per_buf =XFS_BUF_COUNT (bp) >> mp->m_sb.sb_inodelog; + inodes_per_buf =BBTOB (bp->b_io_length) >> mp->m_sb.sb_inodelog;for (i =0 ; i < inodes_per_buf; i++) { next_unlinked_offset = (i * mp->m_sb.sb_inodesize) + offsetof(xfs_dinode_t , di_next_unlinked);
@@ -1816,7 +1816,8 @@ xlog_recover_do_inode_buffer(ASSERT (item->ri_buf[item_index].i_addr !=NULL );ASSERT ((item->ri_buf[item_index].i_len %XFS_BLF_CHUNK ) ==0 ); -ASSERT ((reg_buf_offset + reg_buf_bytes) <=XFS_BUF_COUNT (bp)); +ASSERT ((reg_buf_offset + reg_buf_bytes) <= +BBTOB (bp->b_io_length));/* * The current logged region contains a copy of the
@@ -1875,8 +1876,8 @@ xlog_recover_do_reg_buffer(ASSERT (nbits >0 );ASSERT (item->ri_buf[i].i_addr !=NULL );ASSERT (item->ri_buf[i].i_len %XFS_BLF_CHUNK ==0 ); -ASSERT (XFS_BUF_COUNT (bp) >= - ((uint )bit <<XFS_BLF_SHIFT )+(nbits<<XFS_BLF_SHIFT )); +ASSERT (BBTOB (bp->b_io_length) >= + ((uint )bit <<XFS_BLF_SHIFT ) + (nbits <<XFS_BLF_SHIFT ));/* * Do a sanity check if this is a dquot buffer. Just checking
@@ -2169,7 +2170,7 @@ xlog_recover_buffer_pass2(*/ if (XFS_DINODE_MAGIC ==be16_to_cpu (*((__be16 *)xfs_buf_offset (bp,0 ))) && - (XFS_BUF_COUNT (bp) !=MAX (log->l_mp->m_sb.sb_blocksize, + (BBTOB (bp->b_io_length) !=MAX (log->l_mp->m_sb.sb_blocksize, (__uint32_t )XFS_INODE_CLUSTER_SIZE (log->l_mp)))) {xfs_buf_stale (bp); error =xfs_bwrite (bp);
fs/xfs/xfs_trans_buf.c +2 -2
@@ -56,7 +56,7 @@ xfs_trans_buf_item_match(if (blip->bli_item.li_type ==XFS_LI_BUF && blip->bli_buf->b_target == target &&XFS_BUF_ADDR (blip->bli_buf) == blkno && -XFS_BUF_COUNT (blip->bli_buf) == len) +BBTOB (blip->bli_buf->b_length) == len)return blip->bli_buf; }
@@ -585,7 +585,7 @@ xfs_trans_log_buf(xfs_trans_t *tp,ASSERT (bp->b_transp == tp);ASSERT (bip !=NULL ); -ASSERT ((first <= last) && (last <XFS_BUF_COUNT (bp))); +ASSERT (first <= last && last <BBTOB (bp->b_length));ASSERT (bp->b_iodone ==NULL || bp->b_iodone == xfs_buf_iodone_callbacks);
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 33/37 xfs: move xfs_do_force_shutdown() and kill xfs_rw.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
xfs-do-force_shutdown now is the only thing in xfs_rw.c. There is no need to keep it in it's own file anymore, so move it to xfs_fsops.c next to xfs_fs_goingdown() and kill xfs_rw.c.
--- fs/xfs/Makefile | 1 - fs/xfs/xfs_fsops.c | 60 +++++++++++++++++++++++++++++++++++ fs/xfs/xfs_rw.c | 90 ---------------------------------------------------- 3 files changed, 60 insertions(+), 91 deletions(-) delete mode 100644 fs/xfs/xfs_rw.c
fs/xfs/Makefile +0 -1
@@ -50,7 +50,6 @@ xfs-y += xfs_aops.o \ xfs_sync.o \ xfs_xattr.o \ xfs_rename.o \ - xfs_rw.o \ xfs_utils.o \ xfs_vnodeops.o \ kmem.o \
fs/xfs/xfs_fsops.c +60 -0
63 lines not on this page · raw message
fs/xfs/xfs_rw.c deleted +0 -90
90 lines not on this page · raw message
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 9/37 xfs: on-stack delayed write buffer lists
In reply to Dave ChinnerFrom: Christoph Hellwig <[email protected]>
Queue delwri buffers on a local on-stack list instead of a per-buftarg one, and write back the buffers per-process instead of by waking up xfsbufd.
This is now easily doable given that we have very few places left that write delwri buffers:
- log recovery:
Only done at mount time, and already forcing out the buffers synchronously using xfs_flush_buftarg
- quotacheck:
Same story.
- dquot reclaim:
Writes out dirty dquots on the LRU under memory pressure. We might want to look into doing more of this via xfsaild, but it's already more optimal than the synchronous inode reclaim that writes each buffer synchronously.
- xfsaild:
This is the main beneficiary of the change. By keeping a local list of buffers to write we reduce latency of writing out buffers, and more importably we can remove all the delwri list promotions which were hitting the buffer cache hard under sustained metadata loads.
The implementation is very straight forward - xfs_buf_delwri_queue now gets a new list_head pointer that it adds the delwri buffers to, and all callers need to eventually submit the list using xfs_buf_delwi_submit or xfs_buf_delwi_submit_nowait. Buffers that already are on a delwri list are skipped in xfs_buf_delwri_queue, assuming they already are on another delwri list. The biggest change to pass down the buffer list was done to the AIL pushing. Now that we operate on buffers the trylock, push and pushbuf log item methods are merged into a single push routine, which tries to lock the item, and if possible add the buffer that needs writeback to the buffer list. This leads to much simpler code than the previous split but requires the individual IOP_PUSH instances to unlock and reacquire the AIL around calls to blocking routines.
Given that xfsailds now also handle writing out buffers, the conditions for log forcing and the sleep times needed some small changes. The most important one is that we consider an AIL busy as long we still have buffers to push, and the other one is that we do increment the pushed LSN for buffers that are under flushing at this moment, but still count them towards the stuck items for restart purposes. Without this we could hammer on stuck items without ever forcing the log and not make progress under heavy random delete workloads on fast flash storage devices.
[ Dave Chinner:
- rebase on previous patches.
- improved comments for XBF_DELWRI_Q handling
- fix XBF_ASYNC handling in queue submission (test 106 failure)
- rename delwri submit function buffer list parameters for clarity
- xfs_efd_item_push() should return XFS_ITEM_PINNED ]
--- fs/xfs/xfs_buf.c | 341 +++++++++++++++++---------------------------- fs/xfs/xfs_buf.h | 28 +--- fs/xfs/xfs_buf_item.c | 96 ++++--------- fs/xfs/xfs_dquot.c | 33 ----- fs/xfs/xfs_dquot.h | 1 - fs/xfs/xfs_dquot_item.c | 161 +++++---------------- fs/xfs/xfs_extfree_item.c | 55 ++------ fs/xfs/xfs_inode.c | 25 +--- fs/xfs/xfs_inode.h | 1 - fs/xfs/xfs_inode_item.c | 152 +++++--------------- fs/xfs/xfs_log_recover.c | 46 +++--- fs/xfs/xfs_qm.c | 148 ++++++++++---------- fs/xfs/xfs_super.c | 16 --- fs/xfs/xfs_sync.c | 18 --- fs/xfs/xfs_trace.h | 7 +- fs/xfs/xfs_trans.h | 18 +-- fs/xfs/xfs_trans_ail.c | 129 ++++++++--------- fs/xfs/xfs_trans_buf.c | 84 ++++------- fs/xfs/xfs_trans_priv.h | 1 + 19 files changed, 442 insertions(+), 918 deletions(-)
fs/xfs/xfs_buf.c +131 -210
@@ -42,7 +42,6 @@#include "xfs_trace.h" static kmem_zone_t *xfs_buf_zone; -STATIC int xfsbufd(void *);static struct workqueue_struct *xfslogd_workqueue;
@@ -144,8 +143,17 @@ voidxfs_buf_stale ( struct xfs_buf *bp) { +ASSERT (xfs_buf_islocked (bp)); + bp->b_flags |=XBF_STALE ; -xfs_buf_delwri_dequeue (bp); + +/* +* Clear the delwri status so that a delwri queue walker will not +* flush this buffer to disk now that it is stale. The delwri queue has +* a reference to the buffer, so this is safe to do. +*/ + bp->b_flags &= ~_XBF_DELWRI_Q; +atomic_set (&(bp)->b_lru_ref,0 );if (!list_empty (&bp->b_lru)) {struct xfs_buftarg *btp = bp->b_target;
@@ -592,10 +600,10 @@ _xfs_buf_read( {int status; -ASSERT (!(flags & (XBF_DELWRI |XBF_WRITE ))); +ASSERT (!(flags &XBF_WRITE ));ASSERT (bp->b_bn !=XFS_BUF_DADDR_NULL ); - bp->b_flags &= ~(XBF_WRITE |XBF_ASYNC |XBF_DELWRI |XBF_READ_AHEAD ); + bp->b_flags &= ~(XBF_WRITE |XBF_ASYNC |XBF_READ_AHEAD ); bp->b_flags |= flags & (XBF_READ |XBF_ASYNC |XBF_READ_AHEAD ); status =xfs_buf_iorequest (bp);
@@ -855,7 +863,7 @@ xfs_buf_rele(spin_unlock (&pag->pag_buf_lock); }else {xfs_buf_lru_del (bp); -ASSERT (!(bp->b_flags & (XBF_DELWRI |_XBF_DELWRI_Q))); +ASSERT (!(bp->b_flags & _XBF_DELWRI_Q));rb_erase (&bp->b_rbnode, &pag->pag_buf_tree);spin_unlock (&pag->pag_buf_lock);xfs_perag_put (pag);
@@ -915,13 +923,6 @@ xfs_buf_lock(trace_xfs_buf_lock_done (bp, _RET_IP_); } -/* -* Releases the lock on the buffer object. -* If the buffer is marked delwri but is not queued, do so before we -* unlock the buffer as we need to set flags correctly. We also need to -* take a reference for the delwri queue because the unlocker is going to -* drop their's and they don't know we just queued it. -*/ void xfs_buf_unlock (struct xfs_buf *bp)
@@ -1019,10 +1020,11 @@ xfs_bwrite( {int error; +ASSERT (xfs_buf_islocked (bp)); + bp->b_flags |=XBF_WRITE ; - bp->b_flags &= ~(XBF_ASYNC |XBF_READ ); + bp->b_flags &= ~(XBF_ASYNC |XBF_READ | _XBF_DELWRI_Q); -xfs_buf_delwri_dequeue (bp);xfs_bdstrat_cb (bp); error =xfs_buf_iowait (bp);
@@ -1254,7 +1256,7 @@ xfs_buf_iorequest( {trace_xfs_buf_iorequest (bp, _RET_IP_); -ASSERT (!(bp->b_flags &XBF_DELWRI )); +ASSERT (!(bp->b_flags & _XBF_DELWRI_Q));if (bp->b_flags &XBF_WRITE )xfs_buf_wait_unpin (bp);
@@ -1435,11 +1437,9 @@ xfs_free_buftarg( {unregister_shrinker (&btp->bt_shrinker); -xfs_flush_buftarg (btp,1 );if (mp->m_flags &XFS_MOUNT_BARRIER )xfs_blkdev_issue_flush (btp); -kthread_stop (btp->bt_task);kmem_free (btp); }
@@ -1491,20 +1491,6 @@ xfs_setsize_buftarg(return xfs_setsize_buftarg_flags (btp, blocksize, sectorsize,1 ); } -STATIC int -xfs_alloc_delwri_queue ( -xfs_buftarg_t *btp, -const char *fsname) -{ -INIT_LIST_HEAD (&btp->bt_delwri_queue); -spin_lock_init (&btp->bt_delwri_lock); - btp->bt_flags =0 ; - btp->bt_task =kthread_run (xfsbufd, btp,"xfsbufd/%s" , fsname); -if (IS_ERR (btp->bt_task)) -return PTR_ERR (btp->bt_task); -return 0 ; -} -xfs_buftarg_t * xfs_alloc_buftarg( struct xfs_mount *mp,
@@ -1527,8 +1513,6 @@ xfs_alloc_buftarg(spin_lock_init (&btp->bt_lru_lock);if (xfs_setsize_buftarg_early (btp, bdev)) goto error; -if (xfs_alloc_delwri_queue (btp, fsname)) - goto error; btp->bt_shrinker.shrink = xfs_buftarg_shrink; btp->bt_shrinker.seeks =DEFAULT_SEEKS ;register_shrinker (&btp->bt_shrinker);
@@ -1539,125 +1523,52 @@ error:return NULL ; } -/* -* Delayed write buffer handling +* Add a buffer to the delayed write list. +* +* This queues a buffer for writeout if it hasn't already been. Note that +* neither this routine nor the buffer list submission functions perform +* any internal synchronization. It is expected that the lists are thread-local +* to the callers. +* +* Returns true if we queued up the buffer, or false if it already had +* been on the buffer list. */ -void +bool xfs_buf_delwri_queue ( -xfs_buf_t *bp) +struct xfs_buf *bp, +struct list_head *list) { -struct xfs_buftarg *btp = bp->b_target; - -trace_xfs_buf_delwri_queue (bp, _RET_IP_); - +ASSERT (xfs_buf_islocked (bp));ASSERT (!(bp->b_flags &XBF_READ )); -spin_lock (&btp->bt_delwri_lock); -if (!list_empty (&bp->b_list)) { -/* if already in the queue, move it to the tail */ -ASSERT (bp->b_flags & _XBF_DELWRI_Q); -list_move_tail (&bp->b_list, &btp->bt_delwri_queue); - }else { -/* start xfsbufd as it is about to have something to do */ -if (list_empty (&btp->bt_delwri_queue)) -wake_up_process (bp->b_target->bt_task); - -atomic_inc (&bp->b_hold); - bp->b_flags |=XBF_DELWRI | _XBF_DELWRI_Q |XBF_ASYNC ; -list_add_tail (&bp->b_list, &btp->bt_delwri_queue); - } - bp->b_queuetime = jiffies; -spin_unlock (&btp->bt_delwri_lock); -} - -void -xfs_buf_delwri_dequeue ( -xfs_buf_t *bp) -{ -int dequeued =0 ; - -spin_lock (&bp->b_target->bt_delwri_lock); -if ((bp->b_flags &XBF_DELWRI ) && !list_empty (&bp->b_list)) { -ASSERT (bp->b_flags & _XBF_DELWRI_Q); -list_del_init (&bp->b_list); - dequeued =1 ; +/* +* If the buffer is already marked delwri it already is queued up +* by someone else for imediate writeout. Just ignore it in that +* case. +*/ +if (bp->b_flags & _XBF_DELWRI_Q) { +trace_xfs_buf_delwri_queued (bp, _RET_IP_); +return false; } - bp->b_flags &= ~(XBF_DELWRI |_XBF_DELWRI_Q); -spin_unlock (&bp->b_target->bt_delwri_lock); - -if (dequeued) -xfs_buf_rele (bp); - -trace_xfs_buf_delwri_dequeue (bp, _RET_IP_); -} -/* -* If a delwri buffer needs to be pushed before it has aged out, then promote -* it to the head of the delwri queue so that it will be flushed on the next -* xfsbufd run. We do this by resetting the queuetime of the buffer to be older -* than the age currently needed to flush the buffer. Hence the next time the -* xfsbufd sees it is guaranteed to be considered old enough to flush. -*/ -void -xfs_buf_delwri_promote ( -struct xfs_buf *bp) -{ -struct xfs_buftarg *btp = bp->b_target; -long age = xfs_buf_age_centisecs *msecs_to_jiffies (10 ) +1 ; - -ASSERT (bp->b_flags &XBF_DELWRI ); -ASSERT (bp->b_flags & _XBF_DELWRI_Q); +trace_xfs_buf_delwri_queue (bp, _RET_IP_);/* -* Check the buffer age before locking the delayed write queue as we -* don't need to promote buffers that are already past the flush age. +* If a buffer gets written out synchronously or marked stale while it +* is on a delwri list we lazily remove it. To do this, the other party +* clears the _XBF_DELWRI_Q flag but otherwise leaves the buffer alone. +* It remains referenced and on the list. In a rare corner case it +* might get readded to a delwri list after the synchronous writeout, in +* which case we need just need to re-add the flag here. */ -if (bp->b_queuetime < jiffies - age) -return ; - bp->b_queuetime = jiffies - age; -spin_lock (&btp->bt_delwri_lock); -list_move (&bp->b_list, &btp->bt_delwri_queue); -spin_unlock (&btp->bt_delwri_lock); -} - -/* -* Move as many buffers as specified to the supplied list -* idicating if we skipped any buffers to prevent deadlocks. -*/ -STATIC int -xfs_buf_delwri_split ( -xfs_buftarg_t *target, -struct list_head *list, -unsigned long age) -{ -xfs_buf_t *bp, *n; -int skipped =0 ; -int force; - - force =test_and_clear_bit (XBT_FORCE_FLUSH , &target->bt_flags); -INIT_LIST_HEAD (list); -spin_lock (&target->bt_delwri_lock); -list_for_each_entry_safe (bp, n, &target->bt_delwri_queue, b_list) { -ASSERT (bp->b_flags &XBF_DELWRI ); - -if (!xfs_buf_ispinned (bp) &&xfs_buf_trylock (bp)) { -if (!force && -time_before (jiffies, bp->b_queuetime + age)) { -xfs_buf_unlock (bp); -break ; - } - - bp->b_flags &= ~(XBF_DELWRI | _XBF_DELWRI_Q); - bp->b_flags |=XBF_WRITE ; -list_move_tail (&bp->b_list, list); -trace_xfs_buf_delwri_split (bp, _RET_IP_); - }else - skipped++; + bp->b_flags |= _XBF_DELWRI_Q; +if (list_empty (&bp->b_list)) { +atomic_inc (&bp->b_hold); +list_add_tail (&bp->b_list, list); } -spin_unlock (&target->bt_delwri_lock); -return skipped; +return true; }/*
@@ -1683,99 +1594,109 @@ xfs_buf_cmp(return 0 ; } -STATIC int -xfsbufd ( -void *data) +static int +__xfs_buf_delwri_submit ( +struct list_head *buffer_list, +struct list_head *io_list, +bool wait) { -xfs_buftarg_t *target = (xfs_buftarg_t *)data; - - current->flags |=PF_MEMALLOC ; - -set_freezable (); +struct blk_plug plug; +struct xfs_buf *bp, *n; +int pinned =0 ; + +list_for_each_entry_safe (bp, n, buffer_list, b_list) { +if (!wait) { +if (xfs_buf_ispinned (bp)) { + pinned++; +continue ; + } +if (!xfs_buf_trylock (bp)) +continue ; + }else { +xfs_buf_lock (bp); + } -do { -long age = xfs_buf_age_centisecs *msecs_to_jiffies (10 ); -long tout = xfs_buf_timer_centisecs *msecs_to_jiffies (10 ); -struct list_head tmp; -struct blk_plug plug; +/* +* Someone else might have written the buffer synchronously or +* marked it stale in the meantime. In that case only the +* _XBF_DELWRI_Q flag got cleared, and we have to drop the +* reference and remove it from the list here. +*/ +if (!(bp->b_flags & _XBF_DELWRI_Q)) { +list_del_init (&bp->b_list); +xfs_buf_relse (bp); +continue ; + } -if (unlikely (freezing (current))) -try_to_freeze (); +list_move_tail (&bp->b_list, io_list); +trace_xfs_buf_delwri_split (bp, _RET_IP_); + } -/* sleep for a long time if there is nothing to do. */ -if (list_empty (&target->bt_delwri_queue)) - tout =MAX_SCHEDULE_TIMEOUT ; -schedule_timeout_interruptible (tout); +list_sort (NULL , io_list, xfs_buf_cmp); -xfs_buf_delwri_split (target, &tmp, age); -list_sort (NULL , &tmp, xfs_buf_cmp); +blk_start_plug (&plug); +list_for_each_entry_safe (bp, n, io_list, b_list) { + bp->b_flags &= ~(_XBF_DELWRI_Q |XBF_ASYNC ); + bp->b_flags |=XBF_WRITE ; -blk_start_plug (&plug); -while (!list_empty (&tmp)) { -struct xfs_buf *bp; - bp = list_first_entry(&tmp, struct xfs_buf, b_list); +if (!wait) { + bp->b_flags |=XBF_ASYNC ;list_del_init (&bp->b_list); -xfs_bdstrat_cb (bp); } -blk_finish_plug (&plug); - }while (!kthread_should_stop ()); +xfs_bdstrat_cb (bp); + } +blk_finish_plug (&plug); -return 0 ; +return pinned; }/* -* Go through all incore buffers, and release buffers if they belong to -* the given device. This is used in filesystem error handling to -* preserve the consistency of its metadata. +* Write out a buffer list asynchronously. +* +* This will take the @buffer_list, write all non-locked and non-pinned buffers +* out and not wait for I/O completion on any of the buffers. This interface +* is only safely useable for callers that can track I/O completion by higher +* level means, e.g. AIL pushing as the @buffer_list is consumed in this +* function. */ int -xfs_flush_buftarg ( -xfs_buftarg_t *target, -int wait) +xfs_buf_delwri_submit_nowait ( +struct list_head *buffer_list) { -xfs_buf_t *bp; -int pincount =0 ; -LIST_HEAD (tmp_list); -LIST_HEAD (wait_list); -struct blk_plug plug; +LIST_HEAD (io_list); +return __xfs_buf_delwri_submit (buffer_list, &io_list, false); +} -flush_workqueue (xfslogd_workqueue); +/* +* Write out a buffer list synchronously. +* +* This will take the @buffer_list, write all buffers out and wait for I/O +* completion on all of the buffers. @buffer_list is consumed by the function, +* so callers must have some other way of tracking buffers if they require such +* functionality. +*/ +int +xfs_buf_delwri_submit ( +struct list_head *buffer_list) +{ +LIST_HEAD (io_list); +int error =0 , error2; +struct xfs_buf *bp; -set_bit (XBT_FORCE_FLUSH , &target->bt_flags); - pincount =xfs_buf_delwri_split (target, &tmp_list,0 ); +__xfs_buf_delwri_submit (buffer_list, &io_list, true); -/* -* Dropped the delayed write list lock, now walk the temporary list. -* All I/O is issued async and then if we need to wait for completion -* we do that after issuing all the IO. -*/ -list_sort (NULL , &tmp_list, xfs_buf_cmp); +/* Wait for IO to complete. */ +while (!list_empty (&io_list)) { + bp = list_first_entry(&io_list, struct xfs_buf, b_list); -blk_start_plug (&plug); -while (!list_empty (&tmp_list)) { - bp = list_first_entry(&tmp_list, struct xfs_buf, b_list); -ASSERT (target == bp->b_target);list_del_init (&bp->b_list); -if (wait) { - bp->b_flags &= ~XBF_ASYNC ; -list_add (&bp->b_list, &wait_list); - } -xfs_bdstrat_cb (bp); - } -blk_finish_plug (&plug); - -if (wait) { -/* Wait for IO to complete. */ -while (!list_empty (&wait_list)) { - bp = list_first_entry(&wait_list, struct xfs_buf, b_list); - -list_del_init (&bp->b_list); -xfs_buf_iowait (bp); -xfs_buf_relse (bp); - } + error2 =xfs_buf_iowait (bp); +xfs_buf_relse (bp); +if (!error) + error = error2; } -return pincount; +return error; }int __init
fs/xfs/xfs_buf.h +6 -22
@@ -49,8 +49,7 @@ typedef enum {#define XBF_MAPPED (1 << 3)/* buffer mapped (b_addr valid) */ #define XBF_ASYNC (1 << 4)/* initiator will not wait for completion */ #define XBF_DONE (1 << 5)/* all pages in the buffer uptodate */ -#define XBF_DELWRI (1 << 6)/* buffer has dirty pages */ -#define XBF_STALE (1 << 7)/* buffer has been staled, do not find it */ +#define XBF_STALE (1 << 6)/* buffer has been staled, do not find it */ /* I/O hints for the BIO layer */ #define XBF_SYNCIO (1 << 10)/* treat this buffer as synchronous I/O */
@@ -65,7 +64,7 @@ typedef enum {/* flags used only internally */ #define _XBF_PAGES (1 << 20)/* backed by refcounted pages */ #define _XBF_KMEM (1 << 21)/* backed by heap memory */ -#define _XBF_DELWRI_Q (1 << 22)/* buffer on delwri queue */ +#define _XBF_DELWRI_Q (1 << 22)/* buffer on a delwri queue */ typedef unsigned int xfs_buf_flags_t ;
@@ -76,7 +75,6 @@ typedef unsigned int xfs_buf_flags_t; { XBF_MAPPED, "MAPPED" }, \ { XBF_ASYNC, "ASYNC" }, \ { XBF_DONE, "DONE" }, \ - { XBF_DELWRI, "DELWRI" }, \ { XBF_STALE, "STALE" }, \ { XBF_SYNCIO, "SYNCIO" }, \ { XBF_FUA, "FUA" }, \
@@ -88,10 +86,6 @@ typedef unsigned int xfs_buf_flags_t; { _XBF_KMEM, "KMEM" }, \ { _XBF_DELWRI_Q, "DELWRI_Q" } -typedef enum { -XBT_FORCE_FLUSH =0 , -}xfs_buftarg_flags_t ; - typedef struct xfs_buftarg { dev_t bt_dev; struct block_device *bt_bdev;
@@ -101,12 +95,6 @@ typedef struct xfs_buftarg {unsigned int bt_sshift;size_t bt_smask; -/* per device delwri queue */ -struct task_struct *bt_task; -struct list_head bt_delwri_queue; -spinlock_t bt_delwri_lock; -unsigned long bt_flags; -/* LRU control structures */ struct shrinker bt_shrinker;struct list_head bt_lru;
@@ -150,7 +138,6 @@ typedef struct xfs_buf {struct xfs_trans *b_transp;struct page **b_pages;/* array of page pointers */ struct page *b_page_array[XB_PAGES ];/* inline pages */ -unsigned long b_queuetime;/* time buffer was queued */ atomic_t b_pin_count;/* pin count */ atomic_t b_io_remaining;/* #outstanding I/O requests */ unsigned int b_page_count;/* size of page array */
@@ -220,24 +207,22 @@ static inline int xfs_buf_geterror(xfs_buf_t *bp)extern xfs_caddr_t xfs_buf_offset (xfs_buf_t *,size_t );/* Delayed Write Buffer Routines */ -extern void xfs_buf_delwri_queue (struct xfs_buf *); -extern void xfs_buf_delwri_dequeue (struct xfs_buf *); -extern void xfs_buf_delwri_promote (struct xfs_buf *); +extern bool xfs_buf_delwri_queue (struct xfs_buf *,struct list_head *); +extern int xfs_buf_delwri_submit (struct list_head *); +extern int xfs_buf_delwri_submit_nowait (struct list_head *);/* Buffer Daemon Setup Routines */ extern int xfs_buf_init (void );extern void xfs_buf_terminate (void );#define XFS_BUF_ZEROFLAGS (bp) \ - ((bp)->b_flags &= ~(XBF_READ|XBF_WRITE|XBF_ASYNC|XBF_DELWRI| \ + ((bp)->b_flags &= ~(XBF_READ|XBF_WRITE|XBF_ASYNC| \ XBF_SYNCIO|XBF_FUA|XBF_FLUSH))void xfs_buf_stale (struct xfs_buf *bp);#define XFS_BUF_UNSTALE (bp) ((bp)->b_flags &= ~XBF_STALE)#define XFS_BUF_ISSTALE (bp) ((bp)->b_flags & XBF_STALE) -#define XFS_BUF_ISDELAYWRITE (bp) ((bp)->b_flags & XBF_DELWRI) -#define XFS_BUF_DONE (bp) ((bp)->b_flags |= XBF_DONE)#define XFS_BUF_UNDONE (bp) ((bp)->b_flags &= ~XBF_DONE)#define XFS_BUF_ISDONE (bp) ((bp)->b_flags & XBF_DONE)
@@ -287,7 +272,6 @@ extern xfs_buftarg_t *xfs_alloc_buftarg(struct xfs_mount *,extern void xfs_free_buftarg (struct xfs_mount *,struct xfs_buftarg *);extern void xfs_wait_buftarg (xfs_buftarg_t *);extern int xfs_setsize_buftarg (xfs_buftarg_t *,unsigned int ,unsigned int ); -extern int xfs_flush_buftarg (xfs_buftarg_t *,int );#define xfs_getsize_buftarg (buftarg) block_size((buftarg)->bt_bdev)#define xfs_readonly_buftarg (buftarg) bdev_read_only((buftarg)->bt_bdev)
fs/xfs/xfs_buf_item.c +26 -70
146 lines not on this page · raw message
fs/xfs/xfs_dquot.c +0 -33
@@ -1005,39 +1005,6 @@ xfs_dqlock2( } } -/* -* Give the buffer a little push if it is incore and -* wait on the flush lock. -*/ -void -xfs_dqflock_pushbuf_wait ( -xfs_dquot_t *dqp) -{ -xfs_mount_t *mp = dqp->q_mount; -xfs_buf_t *bp; - -/* -* Check to see if the dquot has been flushed delayed -* write. If so, grab its buffer and send it -* out immediately. We'll be able to acquire -* the flush lock when the I/O completes. -*/ - bp =xfs_incore (mp->m_ddev_targp, dqp->q_blkno, - mp->m_quotainfo->qi_dqchunklen,XBF_TRYLOCK ); -if (!bp) - goto out_lock; - -if (XFS_BUF_ISDELAYWRITE (bp)) { -if (xfs_buf_ispinned (bp)) -xfs_log_force (mp,0 ); -xfs_buf_delwri_promote (bp); -wake_up_process (bp->b_target->bt_task); - } -xfs_buf_relse (bp); -out_lock: -xfs_dqflock (dqp); -} -int __init xfs_qm_init (void ) {
fs/xfs/xfs_dquot.h +0 -1
@@ -152,7 +152,6 @@ extern int xfs_qm_dqget(xfs_mount_t *, xfs_inode_t *,extern void xfs_qm_dqput (xfs_dquot_t *);extern void xfs_dqlock2 (struct xfs_dquot *,struct xfs_dquot *); -extern void xfs_dqflock_pushbuf_wait (struct xfs_dquot *dqp);static inline struct xfs_dquot *xfs_qm_dqhold (struct xfs_dquot *dqp) {
fs/xfs/xfs_dquot_item.c +36 -125
222 lines not on this page · raw message
fs/xfs/xfs_extfree_item.c +14 -41
102 lines not on this page · raw message
fs/xfs/xfs_inode.c +2 -23
@@ -2347,11 +2347,11 @@ cluster_corrupt_out:*/ rcu_read_unlock ();/* -* Clean up the buffer. If it was B_DELWRI, just release it -- +* Clean up the buffer. If it was delwri, just release it -- * brelse can handle it with no problems. If not, shut down the * filesystem before releasing the buffer. */ - bufwasdelwri =XFS_BUF_ISDELAYWRITE (bp); + bufwasdelwri = (bp->b_flags & _XBF_DELWRI_Q);if (bufwasdelwri)xfs_buf_relse (bp);
@@ -2685,27 +2685,6 @@ corrupt_out:return XFS_ERROR (EFSCORRUPTED ); } -void -xfs_promote_inode ( -struct xfs_inode *ip) -{ -struct xfs_buf *bp; - -ASSERT (xfs_isilocked (ip,XFS_ILOCK_EXCL |XFS_ILOCK_SHARED )); - - bp =xfs_incore (ip->i_mount->m_ddev_targp, ip->i_imap.im_blkno, - ip->i_imap.im_len,XBF_TRYLOCK ); -if (!bp) -return ; - -if (XFS_BUF_ISDELAYWRITE (bp)) { -xfs_buf_delwri_promote (bp); -wake_up_process (ip->i_mount->m_ddev_targp->bt_task); - } - -xfs_buf_relse (bp); -} -/* * Return a pointer to the extent record at file index idx. */
fs/xfs/xfs_inode.h +0 -1
@@ -530,7 +530,6 @@ int xfs_iunlink(struct xfs_trans *, xfs_inode_t *);void xfs_iext_realloc (xfs_inode_t *,int ,int );void xfs_iunpin_wait (xfs_inode_t *);int xfs_iflush (struct xfs_inode *,struct xfs_buf **); -void xfs_promote_inode (struct xfs_inode *);void xfs_lock_inodes (xfs_inode_t **,int ,uint );void xfs_lock_two_inodes (xfs_inode_t *,xfs_inode_t *,uint );
fs/xfs/xfs_inode_item.c +33 -119
195 lines not on this page · raw message
fs/xfs/xfs_log_recover.c +29 -17
131 lines not on this page · raw message
fs/xfs/xfs_qm.c +71 -77
323 lines not on this page · raw message
fs/xfs/xfs_super.c +0 -16
@@ -981,15 +981,7 @@ xfs_fs_put_super( {struct xfs_mount *mp =XFS_M (sb); -/* -* Blow away any referenced inode in the filestreams cache. -* This can and will cause log traffic as inodes go inactive -* here. -*/ xfs_filestream_unmount (mp); - -xfs_flush_buftarg (mp->m_ddev_targp,1 ); -xfs_unmountfs (mp);xfs_syncd_stop (mp);xfs_freesb (mp);
@@ -1404,15 +1396,7 @@ out_destroy_workqueues:return -error; out_unmount: -/* -* Blow away any referenced inode in the filestreams cache. -* This can and will cause log traffic as inodes go inactive -* here. -*/ xfs_filestream_unmount (mp); - -xfs_flush_buftarg (mp->m_ddev_targp,1 ); -xfs_unmountfs (mp);xfs_syncd_stop (mp); goto out_free_sb;
fs/xfs/xfs_sync.c +0 -18
@@ -313,17 +313,10 @@ xfs_quiesce_data(/* write superblock and hoover up shutdown errors */ error =xfs_sync_fsdata (mp); -/* make sure all delwri buffers are written out */ -xfs_flush_buftarg (mp->m_ddev_targp,1 ); -/* mark the log as covered if needed */ if (xfs_log_need_covered (mp)) error2 =xfs_fs_log_dummy (mp); -/* flush data-only devices */ -if (mp->m_rtdev_targp) -xfs_flush_buftarg (mp->m_rtdev_targp,1 ); -return error ? error : error2; }
@@ -684,17 +677,6 @@ restart:if (!xfs_iflock_nowait (ip)) {if (!(sync_mode &SYNC_WAIT )) goto out; - -/* -* If we only have a single dirty inode in a cluster there is -* a fair chance that the AIL push may have pushed it into -* the buffer, but xfsbufd won't touch it until 30 seconds -* from now, and thus we will lock up here. -* -* Promote the inode buffer to the front of the delwri list -* and wake up xfsbufd now. -*/ -xfs_promote_inode (ip);xfs_iflock (ip); }
fs/xfs/xfs_trace.h +2 -5
@@ -328,7 +328,7 @@ DEFINE_BUF_EVENT(xfs_buf_unlock);DEFINE_BUF_EVENT (xfs_buf_iowait);DEFINE_BUF_EVENT (xfs_buf_iowait_done);DEFINE_BUF_EVENT (xfs_buf_delwri_queue); -DEFINE_BUF_EVENT (xfs_buf_delwri_dequeue); +DEFINE_BUF_EVENT (xfs_buf_delwri_queued);DEFINE_BUF_EVENT (xfs_buf_delwri_split);DEFINE_BUF_EVENT (xfs_buf_get_uncached);DEFINE_BUF_EVENT (xfs_bdstrat_shut);
@@ -486,12 +486,10 @@ DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);DEFINE_BUF_ITEM_EVENT (xfs_buf_item_pin);DEFINE_BUF_ITEM_EVENT (xfs_buf_item_unpin);DEFINE_BUF_ITEM_EVENT (xfs_buf_item_unpin_stale); -DEFINE_BUF_ITEM_EVENT (xfs_buf_item_trylock);DEFINE_BUF_ITEM_EVENT (xfs_buf_item_unlock);DEFINE_BUF_ITEM_EVENT (xfs_buf_item_unlock_stale);DEFINE_BUF_ITEM_EVENT (xfs_buf_item_committed);DEFINE_BUF_ITEM_EVENT (xfs_buf_item_push); -DEFINE_BUF_ITEM_EVENT (xfs_buf_item_pushbuf);DEFINE_BUF_ITEM_EVENT (xfs_trans_get_buf);DEFINE_BUF_ITEM_EVENT (xfs_trans_get_buf_recur);DEFINE_BUF_ITEM_EVENT (xfs_trans_getsb);
@@ -881,10 +879,9 @@ DEFINE_EVENT(xfs_log_item_class, name, \ TP_PROTO(struct xfs_log_item *lip), \ TP_ARGS(lip)) DEFINE_LOG_ITEM_EVENT(xfs_ail_push); -DEFINE_LOG_ITEM_EVENT(xfs_ail_pushbuf); -DEFINE_LOG_ITEM_EVENT(xfs_ail_pushbuf_pinned); DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned); DEFINE_LOG_ITEM_EVENT(xfs_ail_locked); +DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing); DECLARE_EVENT_CLASS(xfs_file_class,
fs/xfs/xfs_trans.h +7 -11
@@ -347,11 +347,9 @@ struct xfs_item_ops {void (*iop_format)(xfs_log_item_t *,struct xfs_log_iovec *);void (*iop_pin)(xfs_log_item_t *);void (*iop_unpin)(xfs_log_item_t *,int remove); -uint (*iop_trylock)(xfs_log_item_t *); +uint (*iop_push)(struct xfs_log_item *,struct list_head *);void (*iop_unlock)(xfs_log_item_t *);xfs_lsn_t (*iop_committed)(xfs_log_item_t *,xfs_lsn_t ); -void (*iop_push)(xfs_log_item_t *); -bool (*iop_pushbuf)(xfs_log_item_t *);void (*iop_committing)(xfs_log_item_t *,xfs_lsn_t ); };
@@ -359,20 +357,18 @@ struct xfs_item_ops {#define IOP_FORMAT (ip,vp) (*(ip)->li_ops->iop_format)(ip, vp)#define IOP_PIN (ip) (*(ip)->li_ops->iop_pin)(ip)#define IOP_UNPIN (ip, remove) (*(ip)->li_ops->iop_unpin)(ip, remove) -#define IOP_TRYLOCK (ip) (*(ip)->li_ops->iop_trylock)(ip) +#define IOP_PUSH (ip, list) (*(ip)->li_ops->iop_push)(ip, list)#define IOP_UNLOCK (ip) (*(ip)->li_ops->iop_unlock)(ip)#define IOP_COMMITTED (ip, lsn) (*(ip)->li_ops->iop_committed)(ip, lsn) -#define IOP_PUSH (ip) (*(ip)->li_ops->iop_push)(ip) -#define IOP_PUSHBUF (ip) (*(ip)->li_ops->iop_pushbuf)(ip)#define IOP_COMMITTING (ip, lsn) (*(ip)->li_ops->iop_committing)(ip, lsn)/* -* Return values for the IOP_TRYLOCK() routines. +* Return values for the IOP_PUSH() routines. */ -#define XFS_ITEM_SUCCESS 0 -#define XFS_ITEM_PINNED 1 -#define XFS_ITEM_LOCKED 2 -#define XFS_ITEM_PUSHBUF 3 +#define XFS_ITEM_SUCCESS 0 +#define XFS_ITEM_PINNED 1 +#define XFS_ITEM_LOCKED 2 +#define XFS_ITEM_FLUSHING 3/* * This is the type of function which can be given to xfs_trans_callback()
fs/xfs/xfs_trans_ail.c +57 -72
218 lines not on this page · raw message
fs/xfs/xfs_trans_buf.c +27 -57
116 lines not on this page · raw message
fs/xfs/xfs_trans_priv.h +1 -0
@@ -71,6 +71,7 @@ struct xfs_ail {spinlock_t xa_lock;xfs_lsn_t xa_last_pushed_lsn;int xa_log_flush; +struct list_head xa_buf_list;wait_queue_head_t xa_empty; };
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 19/37 xfs: clean up buffer get/read call API
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The xfs_buf_get/read API is not consistent in the units it uses, and does not use appropriate or consistent units/types for the variables.
Convert the API to use disk addresses and block counts for all buffer get and read calls. Use consistent naming for all the functions and their declarations, and convert the internal functions to use disk addresses and block counts to avoid need to convert them from one type to another and back again.
Fix all the callers to use disk addresses and block counts. In many cases, this removes an additional conversion from the function call as the callers already have a block count.
--- fs/xfs/xfs_buf.c | 86 +++++++++++++++++++++++++--------------------- fs/xfs/xfs_buf.h | 38 +++++++++++--------- fs/xfs/xfs_fsops.c | 4 +-- fs/xfs/xfs_log.c | 6 ++-- fs/xfs/xfs_log_recover.c | 2 +- fs/xfs/xfs_mount.c | 12 +++---- fs/xfs/xfs_rtalloc.c | 8 ++--- fs/xfs/xfs_vnodeops.c | 2 +- 8 files changed, 84 insertions(+), 74 deletions(-)
fs/xfs/xfs_buf.c +46 -40
@@ -172,8 +172,8 @@ xfs_buf_stale(struct xfs_buf *xfs_buf_alloc (struct xfs_buftarg *target, -xfs_off_t range_base, -size_t range_length, +xfs_daddr_t blkno, +size_t numblks,xfs_buf_flags_t flags) {struct xfs_buf *bp;
@@ -196,14 +196,21 @@ xfs_buf_alloc(sema_init (&bp->b_sema,0 );/* held, no waiters */ XB_SET_OWNER (bp); bp->b_target = target; - bp->b_file_offset = range_base; + bp->b_file_offset = blkno <<BBSHIFT ;/* * Set buffer_length and count_desired to the same value initially. * I/O routines should use count_desired, which will be the same in * most cases but may be reset (e.g. XFS recovery). */ - bp->b_buffer_length = bp->b_count_desired = range_length; + bp->b_buffer_length = bp->b_count_desired = numblks <<BBSHIFT ; bp->b_flags = flags; + +/* +* We do not set the block number here in the buffer because we have not +* finished initialising the buffer. We insert the buffer into the cache +* in this state, so this ensures that we are unable to do IO on a +* buffer that hasn't been fully initialised. +*/ bp->b_bn =XFS_BUF_DADDR_NULL ;atomic_set (&bp->b_pin_count,0 );init_waitqueue_head (&bp->b_waiters);
@@ -426,29 +433,29 @@ _xfs_buf_map_pages(*/ xfs_buf_t *_xfs_buf_find ( -xfs_buftarg_t *btp,/* block device target */ -xfs_off_t ioff,/* starting offset of range */ -size_t isize,/* length of range */ +struct xfs_buftarg *btp, +xfs_daddr_t blkno, +size_t numblks,xfs_buf_flags_t flags,xfs_buf_t *new_bp) { -xfs_off_t range_base; -size_t range_length; +xfs_off_t offset; +size_t numbytes;struct xfs_perag *pag;struct rb_node **rbp;struct rb_node *parent;xfs_buf_t *bp; - range_base = (ioff <<BBSHIFT ); - range_length = (isize <<BBSHIFT ); + offset =BBTOB (blkno); + numbytes =BBTOB (numblks);/* Check for IOs smaller than the sector size / not sector aligned */ -ASSERT (!(range_length < (1 << btp->bt_sshift))); -ASSERT (!(range_base & (xfs_off_t )btp->bt_smask)); +ASSERT (!(numbytes < (1 << btp->bt_sshift))); +ASSERT (!(offset & (xfs_off_t )btp->bt_smask));/* get tree root */ pag =xfs_perag_get (btp->bt_mount, -xfs_daddr_to_agno (btp->bt_mount, ioff)); +xfs_daddr_to_agno (btp->bt_mount, blkno));/* walk tree */ spin_lock (&pag->pag_buf_lock);
@@ -459,9 +466,9 @@ _xfs_buf_find( parent = *rbp; bp = rb_entry(parent, struct xfs_buf, b_rbnode); -if (range_base < bp->b_file_offset) +if (offset < bp->b_file_offset) rbp = &(*rbp)->rb_left; -else if (range_base > bp->b_file_offset) +else if (offset > bp->b_file_offset) rbp = &(*rbp)->rb_right;else {/*
@@ -472,7 +479,7 @@ _xfs_buf_find(* reallocating a busy extent. Skip this buffer and * continue searching to the right for an exact match. */ -if (bp->b_buffer_length != range_length) { +if (bp->b_buffer_length != numbytes) {ASSERT (bp->b_flags &XBF_STALE ); rbp = &(*rbp)->rb_right;continue ;
@@ -532,21 +539,20 @@ found:*/ struct xfs_buf *xfs_buf_get ( -xfs_buftarg_t *target,/* target for buffer */ -xfs_off_t ioff,/* starting offset of range */ -size_t isize,/* length of range */ +xfs_buftarg_t *target, +xfs_daddr_t blkno, +size_t numblks,xfs_buf_flags_t flags) {struct xfs_buf *bp;struct xfs_buf *new_bp;int error =0 ; - bp =_xfs_buf_find (target, ioff, isize, flags,NULL ); + bp =_xfs_buf_find (target, blkno, numblks, flags,NULL );if (likely (bp)) goto found; - new_bp =xfs_buf_alloc (target, ioff <<BBSHIFT , isize <<BBSHIFT , - flags); + new_bp =xfs_buf_alloc (target, blkno, numblks, flags);if (unlikely (!new_bp))return NULL ;
@@ -556,7 +562,7 @@ xfs_buf_get(return NULL ; } - bp =_xfs_buf_find (target, ioff, isize, flags, new_bp); + bp =_xfs_buf_find (target, blkno, numblks, flags, new_bp);if (!bp) {xfs_buf_free (new_bp);return NULL ;
@@ -569,7 +575,7 @@ xfs_buf_get(* Now we have a workable buffer, fill in the block number so * that we can do IO on it. */ - bp->b_bn = ioff; + bp->b_bn = blkno; bp->b_count_desired = bp->b_buffer_length; found:
@@ -613,15 +619,15 @@ _xfs_buf_read(xfs_buf_t *xfs_buf_read (xfs_buftarg_t *target, -xfs_off_t ioff, -size_t isize, +xfs_daddr_t blkno, +size_t numblks,xfs_buf_flags_t flags) {xfs_buf_t *bp; flags |=XBF_READ ; - bp =xfs_buf_get (target, ioff, isize, flags); + bp =xfs_buf_get (target, blkno, numblks, flags);if (bp) {trace_xfs_buf_read (bp, flags, _RET_IP_);
@@ -656,13 +662,13 @@ xfs_buf_read(void xfs_buf_readahead (xfs_buftarg_t *target, -xfs_off_t ioff, -size_t isize) +xfs_daddr_t blkno, +size_t numblks) {if (bdi_read_congested (target->bt_bdi))return ; -xfs_buf_read (target, ioff, isize, +xfs_buf_read (target, blkno, numblks,XBF_TRYLOCK |XBF_ASYNC |XBF_READ_AHEAD |XBF_DONT_BLOCK ); }
@@ -672,16 +678,15 @@ xfs_buf_readahead(*/ struct xfs_buf *xfs_buf_read_uncached ( -struct xfs_mount *mp,struct xfs_buftarg *target,xfs_daddr_t daddr, -size_t length, +size_t numblks,int flags) {xfs_buf_t *bp;int error; - bp =xfs_buf_get_uncached (target, length, flags); + bp =xfs_buf_get_uncached (target, numblks, flags);if (!bp)return NULL ;
@@ -689,7 +694,7 @@ xfs_buf_read_uncached(XFS_BUF_SET_ADDR (bp, daddr);XFS_BUF_READ (bp); -xfsbdstrat (mp, bp); +xfsbdstrat (target->bt_mount, bp); error =xfs_buf_iowait (bp);if (error) {xfs_buf_relse (bp);
@@ -705,7 +710,7 @@ xfs_buf_read_uncached(void xfs_buf_set_empty (struct xfs_buf *bp, -size_t len) +size_t numblks) {if (bp->b_pages)_xfs_buf_free_pages (bp);
@@ -714,7 +719,7 @@ xfs_buf_set_empty( bp->b_page_count =0 ; bp->b_addr =NULL ; bp->b_file_offset =0 ; - bp->b_buffer_length = bp->b_count_desired = len; + bp->b_buffer_length = bp->b_count_desired = numblks <<BBSHIFT ; bp->b_bn =XFS_BUF_DADDR_NULL ; bp->b_flags &= ~XBF_MAPPED ; }
@@ -776,17 +781,18 @@ xfs_buf_associate_memory(xfs_buf_t *xfs_buf_get_uncached (struct xfs_buftarg *target, -size_t len, +size_t numblks,int flags) { -unsigned long page_count =PAGE_ALIGN (len) >>PAGE_SHIFT ; +unsigned long page_count;int error, i;xfs_buf_t *bp; - bp =xfs_buf_alloc (target,0 , len,0 ); + bp =xfs_buf_alloc (target,0 , numblks,0 );if (unlikely (bp ==NULL )) goto fail; + page_count =PAGE_ALIGN (numblks <<BBSHIFT ) >>PAGE_SHIFT ; error =_xfs_buf_get_pages (bp, page_count,0 );if (error) goto fail_free_buf;
fs/xfs/xfs_buf.h +21 -17
@@ -150,26 +150,30 @@ typedef struct xfs_buf {/* Finding and Reading Buffers */ -extern xfs_buf_t *_xfs_buf_find (xfs_buftarg_t *,xfs_off_t ,size_t , -xfs_buf_flags_t ,xfs_buf_t *); +struct xfs_buf *_xfs_buf_find (struct xfs_buftarg *target,xfs_daddr_t blkno, +size_t numblks,xfs_buf_flags_t flags, +struct xfs_buf *new_bp);#define xfs_incore (buftarg,blkno,len,lockit) \ _xfs_buf_find(buftarg, blkno ,len, lockit, NULL) -extern xfs_buf_t *xfs_buf_get (xfs_buftarg_t *,xfs_off_t ,size_t , -xfs_buf_flags_t ); -extern xfs_buf_t *xfs_buf_read (xfs_buftarg_t *,xfs_off_t ,size_t , -xfs_buf_flags_t ); - -struct xfs_buf *xfs_buf_alloc (struct xfs_buftarg *,xfs_off_t ,size_t , -xfs_buf_flags_t ); -extern void xfs_buf_set_empty (struct xfs_buf *bp,size_t len); -extern xfs_buf_t *xfs_buf_get_uncached (struct xfs_buftarg *,size_t ,int ); -extern int xfs_buf_associate_memory (xfs_buf_t *,void *,size_t ); -extern void xfs_buf_hold (xfs_buf_t *); -extern void xfs_buf_readahead (xfs_buftarg_t *,xfs_off_t ,size_t ); -struct xfs_buf *xfs_buf_read_uncached (struct xfs_mount *mp, -struct xfs_buftarg *target, -xfs_daddr_t daddr,size_t length,int flags); +struct xfs_buf *xfs_buf_get (struct xfs_buftarg *target,xfs_daddr_t blkno, +size_t numblks,xfs_buf_flags_t flags); +struct xfs_buf *xfs_buf_read (struct xfs_buftarg *target,xfs_daddr_t blkno, +size_t numblks,xfs_buf_flags_t flags); +void xfs_buf_readahead (struct xfs_buftarg *target,xfs_daddr_t blkno, +size_t numblks); + +struct xfs_buf *xfs_buf_get_empty (struct xfs_buftarg *target,size_t numblks); +struct xfs_buf *xfs_buf_alloc (struct xfs_buftarg *target,xfs_daddr_t blkno, +size_t numblks,xfs_buf_flags_t flags); +void xfs_buf_set_empty (struct xfs_buf *bp,size_t numblks); +int xfs_buf_associate_memory (struct xfs_buf *bp,void *mem,size_t length); + +struct xfs_buf *xfs_buf_get_uncached (struct xfs_buftarg *target,size_t numblks, +int flags); +struct xfs_buf *xfs_buf_read_uncached (struct xfs_buftarg *target, +xfs_daddr_t daddr,size_t numblks,int flags); +void xfs_buf_hold (struct xfs_buf *bp);/* Releasing Buffers */ extern void xfs_buf_free (xfs_buf_t *);
fs/xfs/xfs_fsops.c +2 -2
@@ -147,9 +147,9 @@ xfs_growfs_data_private(if ((error =xfs_sb_validate_fsb_count (&mp->m_sb, nb)))return error; dpct = pct - mp->m_sb.sb_imax_pct; - bp =xfs_buf_read_uncached (mp, mp->m_ddev_targp, + bp =xfs_buf_read_uncached (mp->m_ddev_targp,XFS_FSB_TO_BB (mp, nb) -XFS_FSS_TO_BB (mp,1 ), -BBTOB (XFS_FSS_TO_BB (mp,1 )),0 ); +XFS_FSS_TO_BB (mp,1 ),0 );if (!bp)return EIO ;xfs_buf_relse (bp);
fs/xfs/xfs_log.c +3 -3
@@ -1187,7 +1187,7 @@ xlog_alloc_log(xfs_mount_t *mp,xlog_get_iclog_buffer_size (mp, log); error =ENOMEM ; - bp =xfs_buf_alloc (mp->m_logdev_targp,0 , log->l_iclog_size,0 ); + bp =xfs_buf_alloc (mp->m_logdev_targp,0 ,BTOBB (log->l_iclog_size),0 );if (!bp) goto out_free_log; bp->b_iodone = xlog_iodone;
@@ -1219,7 +1219,7 @@ xlog_alloc_log(xfs_mount_t *mp, prev_iclog = iclog; bp =xfs_buf_get_uncached (mp->m_logdev_targp, - log->l_iclog_size,0 ); +BTOBB (log->l_iclog_size),0 );if (!bp) goto out_free_iclog;
@@ -1588,7 +1588,7 @@ xlog_dealloc_log(xlog_t *log)* always need to ensure that the extra buffer does not point to memory * owned by another log buffer before we free it. */ -xfs_buf_set_empty (log->l_xbuf, log->l_iclog_size); +xfs_buf_set_empty (log->l_xbuf,BTOBB (log->l_iclog_size));xfs_buf_free (log->l_xbuf); iclog = log->l_iclog;
fs/xfs/xfs_log_recover.c +1 -1
@@ -120,7 +120,7 @@ xlog_get_bp( nbblks += log->l_sectBBsize; nbblks =round_up (nbblks, log->l_sectBBsize); - bp =xfs_buf_get_uncached (log->l_mp->m_logdev_targp,BBTOB (nbblks),0 ); + bp =xfs_buf_get_uncached (log->l_mp->m_logdev_targp, nbblks,0 );if (bp)xfs_buf_unlock (bp);return bp;
fs/xfs/xfs_mount.c +6 -6
@@ -684,8 +684,8 @@ xfs_readsb(xfs_mount_t *mp, int flags) sector_size =xfs_getsize_buftarg (mp->m_ddev_targp); reread: - bp =xfs_buf_read_uncached (mp, mp->m_ddev_targp, -XFS_SB_DADDR , sector_size,0 ); + bp =xfs_buf_read_uncached (mp->m_ddev_targp,XFS_SB_DADDR , +BTOBB (sector_size),0 );if (!bp) {if (loud)xfs_warn (mp,"SB buffer read failed" );
@@ -1033,9 +1033,9 @@ xfs_check_sizes(xfs_mount_t *mp)xfs_warn (mp,"filesystem size mismatch detected" );return XFS_ERROR (EFBIG ); } - bp =xfs_buf_read_uncached (mp, mp->m_ddev_targp, + bp =xfs_buf_read_uncached (mp->m_ddev_targp, d -XFS_FSS_TO_BB (mp,1 ), -BBTOB (XFS_FSS_TO_BB (mp,1 )),0 ); +XFS_FSS_TO_BB (mp,1 ),0 );if (!bp) {xfs_warn (mp,"last sector read failed" );return EIO ;
@@ -1048,9 +1048,9 @@ xfs_check_sizes(xfs_mount_t *mp)xfs_warn (mp,"log size mismatch detected" );return XFS_ERROR (EFBIG ); } - bp =xfs_buf_read_uncached (mp, mp->m_logdev_targp, + bp =xfs_buf_read_uncached (mp->m_logdev_targp, d -XFS_FSB_TO_BB (mp,1 ), -XFS_FSB_TO_B (mp,1 ),0 ); +XFS_FSB_TO_BB (mp,1 ),0 );if (!bp) {xfs_warn (mp,"log device read failed" );return EIO ;
fs/xfs/xfs_rtalloc.c +4 -4
@@ -1872,9 +1872,9 @@ xfs_growfs_rt(/* * Read in the last block of the device, make sure it exists. */ - bp =xfs_buf_read_uncached (mp, mp->m_rtdev_targp, + bp =xfs_buf_read_uncached (mp->m_rtdev_targp,XFS_FSB_TO_BB (mp, nrblocks -1 ), -XFS_FSB_TO_B (mp,1 ),0 ); +XFS_FSB_TO_BB (mp,1 ),0 );if (!bp)return EIO ;xfs_buf_relse (bp);
@@ -2219,9 +2219,9 @@ xfs_rtmount_init( (unsigned long long) mp->m_sb.sb_rblocks);return XFS_ERROR (EFBIG ); } - bp =xfs_buf_read_uncached (mp, mp->m_rtdev_targp, + bp =xfs_buf_read_uncached (mp->m_rtdev_targp, d -XFS_FSB_TO_BB (mp,1 ), -XFS_FSB_TO_B (mp,1 ),0 ); +XFS_FSB_TO_BB (mp,1 ),0 );if (!bp) {xfs_warn (mp,"realtime device size check failed" );return EIO ;
fs/xfs/xfs_vnodeops.c +1 -1
@@ -1966,7 +1966,7 @@ xfs_zero_remaining_bytes( bp =xfs_buf_get_uncached (XFS_IS_REALTIME_INODE (ip) ? mp->m_rtdev_targp : mp->m_ddev_targp, - mp->m_sb.sb_blocksize,XBF_DONT_BLOCK ); +BTOBB (mp->m_sb.sb_blocksize),XBF_DONT_BLOCK );if (!bp)return XFS_ERROR (ENOMEM );
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 24/37 xfs: kill XBF_LOCK
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Buffers are always returned locked from the lookup routines. Hence we don't need to tell the lookup routines to return locked buffers, on to try and lock them. Remove XBF_LOCK from all the callers and from internal buffer cache usage.
--- fs/xfs/xfs_attr.c | 5 ++--- fs/xfs/xfs_attr_leaf.c | 2 +- fs/xfs/xfs_buf.c | 20 +++++--------------- fs/xfs/xfs_buf.h | 4 +--- fs/xfs/xfs_fsops.c | 13 +++++-------- fs/xfs/xfs_ialloc.c | 3 +-- fs/xfs/xfs_inode.c | 16 +++++++--------- fs/xfs/xfs_log_recover.c | 7 +++---- fs/xfs/xfs_rw.c | 2 +- fs/xfs/xfs_trans_buf.c | 4 ++-- fs/xfs/xfs_vnodeops.c | 2 +- 11 files changed, 29 insertions(+), 49 deletions(-)
fs/xfs/xfs_attr.c +2 -3
@@ -1988,8 +1988,7 @@ xfs_attr_rmtval_get(xfs_da_args_t *args) dblkno =XFS_FSB_TO_DADDR (mp, map[i].br_startblock); blkcnt =XFS_FSB_TO_BB (mp, map[i].br_blockcount); error =xfs_read_buf (mp, mp->m_ddev_targp, dblkno, - blkcnt,XBF_LOCK |XBF_DONT_BLOCK , - &bp); + blkcnt,XBF_DONT_BLOCK , &bp);if (error)return (error);
@@ -2116,7 +2115,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) blkcnt =XFS_FSB_TO_BB (mp, map.br_blockcount); bp =xfs_buf_get (mp->m_ddev_targp, dblkno, blkcnt, -XBF_LOCK |XBF_DONT_BLOCK ); +XBF_DONT_BLOCK );if (!bp)return ENOMEM ;
fs/xfs/xfs_attr_leaf.c +1 -1
@@ -2983,7 +2983,7 @@ xfs_attr_leaf_freextent(xfs_trans_t **trans, xfs_inode_t *dp, map.br_blockcount); bp =xfs_trans_get_buf (*trans, dp->i_mount->m_ddev_targp, - dblkno, dblkcnt,XBF_LOCK ); + dblkno, dblkcnt,0 );if (!bp)return ENOMEM ;xfs_trans_binval (*trans, bp);
fs/xfs/xfs_buf.c +5 -15
@@ -185,7 +185,7 @@ xfs_buf_alloc(/* * We don't want certain flags to appear in b_flags. */ - flags &= ~(XBF_LOCK |XBF_MAPPED |XBF_DONT_BLOCK |XBF_READ_AHEAD ); + flags &= ~(XBF_MAPPED |XBF_DONT_BLOCK |XBF_READ_AHEAD );atomic_set (&bp->b_hold,1 );atomic_set (&bp->b_lru_ref,1 );
@@ -584,19 +584,14 @@ found:if (unlikely (error)) {xfs_warn (target->bt_mount,"%s: failed to map pages\n" , __func__); - goto no_buffer; +xfs_buf_relse (bp); +return NULL ; } }XFS_STATS_INC (xb_get);trace_xfs_buf_get (bp, flags, _RET_IP_);return bp; - -no_buffer: -if (flags & (XBF_LOCK |XBF_TRYLOCK )) -xfs_buf_unlock (bp); -xfs_buf_rele (bp); -return NULL ; }STATIC int
@@ -639,7 +634,8 @@ xfs_buf_read(* Read ahead call which is already satisfied, * drop the buffer */ - goto no_buffer; +xfs_buf_relse (bp); +return NULL ; }else {/* We do not want read in the flags */ bp->b_flags &= ~XBF_READ ;
@@ -647,12 +643,6 @@ xfs_buf_read( }return bp; - - no_buffer: -if (flags & (XBF_LOCK |XBF_TRYLOCK )) -xfs_buf_unlock (bp); -xfs_buf_rele (bp); -return NULL ; }/*
fs/xfs/xfs_buf.h +1 -3
@@ -52,7 +52,6 @@ typedef enum {#define XBF_FLUSH (1 << 12)/* flush the disk cache before a write */ /* flags used only as arguments to access routines */ -#define XBF_LOCK (1 << 15)/* lock requested */ #define XBF_TRYLOCK (1 << 16)/* lock requested, but do not wait */ #define XBF_DONT_BLOCK (1 << 17)/* do not block in current thread */
@@ -74,8 +73,7 @@ typedef unsigned int xfs_buf_flags_t; { XBF_SYNCIO, "SYNCIO" }, \ { XBF_FUA, "FUA" }, \ { XBF_FLUSH, "FLUSH" }, \ - { XBF_LOCK, "LOCK" }, /* should never be set */\ - { XBF_TRYLOCK, "TRYLOCK" }, /* ditto */\ + { XBF_TRYLOCK, "TRYLOCK" }, /* should never be set */\ { XBF_DONT_BLOCK, "DONT_BLOCK" }, /* ditto */\ { _XBF_PAGES, "PAGES" }, \ { _XBF_KMEM, "KMEM" }, \
fs/xfs/xfs_fsops.c +5 -8
@@ -193,7 +193,7 @@ xfs_growfs_data_private(*/ bp =xfs_buf_get (mp->m_ddev_targp,XFS_AG_DADDR (mp, agno,XFS_AGF_DADDR (mp)), -XFS_FSS_TO_BB (mp,1 ),XBF_LOCK |XBF_MAPPED ); +XFS_FSS_TO_BB (mp,1 ),XBF_MAPPED );if (!bp) { error =ENOMEM ; goto error0;
@@ -230,7 +230,7 @@ xfs_growfs_data_private(*/ bp =xfs_buf_get (mp->m_ddev_targp,XFS_AG_DADDR (mp, agno,XFS_AGI_DADDR (mp)), -XFS_FSS_TO_BB (mp,1 ),XBF_LOCK |XBF_MAPPED ); +XFS_FSS_TO_BB (mp,1 ),XBF_MAPPED );if (!bp) { error =ENOMEM ; goto error0;
@@ -259,8 +259,7 @@ xfs_growfs_data_private(*/ bp =xfs_buf_get (mp->m_ddev_targp,XFS_AGB_TO_DADDR (mp, agno,XFS_BNO_BLOCK (mp)), -BTOBB (mp->m_sb.sb_blocksize), -XBF_LOCK |XBF_MAPPED ); +BTOBB (mp->m_sb.sb_blocksize),XBF_MAPPED );if (!bp) { error =ENOMEM ; goto error0;
@@ -286,8 +285,7 @@ xfs_growfs_data_private(*/ bp =xfs_buf_get (mp->m_ddev_targp,XFS_AGB_TO_DADDR (mp, agno,XFS_CNT_BLOCK (mp)), -BTOBB (mp->m_sb.sb_blocksize), -XBF_LOCK |XBF_MAPPED ); +BTOBB (mp->m_sb.sb_blocksize),XBF_MAPPED );if (!bp) { error =ENOMEM ; goto error0;
@@ -314,8 +312,7 @@ xfs_growfs_data_private(*/ bp =xfs_buf_get (mp->m_ddev_targp,XFS_AGB_TO_DADDR (mp, agno,XFS_IBT_BLOCK (mp)), -BTOBB (mp->m_sb.sb_blocksize), -XBF_LOCK |XBF_MAPPED ); +BTOBB (mp->m_sb.sb_blocksize),XBF_MAPPED );if (!bp) { error =ENOMEM ; goto error0;
fs/xfs/xfs_ialloc.c +1 -2
@@ -200,8 +200,7 @@ xfs_ialloc_inode_init(*/ d =XFS_AGB_TO_DADDR (mp, agno, agbno + (j * blks_per_cluster)); fbuf =xfs_trans_get_buf (tp, mp->m_ddev_targp, d, - mp->m_bsize * blks_per_cluster, -XBF_LOCK ); + mp->m_bsize * blks_per_cluster,0 );if (!fbuf)return ENOMEM ;/*
fs/xfs/xfs_inode.c +7 -9
@@ -226,7 +226,7 @@ xfs_inotobp(if (error)return error; - error =xfs_imap_to_bp (mp, tp, &imap, &bp,XBF_LOCK , imap_flags); + error =xfs_imap_to_bp (mp, tp, &imap, &bp,0 , imap_flags);if (error)return error;
@@ -782,8 +782,7 @@ xfs_iread(/* * Get pointers to the on-disk inode and the buffer containing it. */ - error =xfs_imap_to_bp (mp, tp, &ip->i_imap, &bp, -XBF_LOCK , iget_flags); + error =xfs_imap_to_bp (mp, tp, &ip->i_imap, &bp,0 , iget_flags);if (error)return error; dip = (xfs_dinode_t *)xfs_buf_offset (bp, ip->i_imap.im_boffset);
@@ -1342,7 +1341,7 @@ xfs_iunlink(* Here we put the head pointer into our next pointer, * and then we fall through to point the head at us. */ - error =xfs_itobp (mp, tp, ip, &dip, &ibp,XBF_LOCK ); + error =xfs_itobp (mp, tp, ip, &dip, &ibp,0 );if (error)return error;
@@ -1423,7 +1422,7 @@ xfs_iunlink_remove(* of dealing with the buffer when there is no need to * change it. */ - error =xfs_itobp (mp, tp, ip, &dip, &ibp,XBF_LOCK ); + error =xfs_itobp (mp, tp, ip, &dip, &ibp,0 );if (error) {xfs_warn (mp,"%s: xfs_itobp() returned error %d." , __func__, error);
@@ -1484,7 +1483,7 @@ xfs_iunlink_remove(* Now last_ibp points to the buffer previous to us on * the unlinked list. Pull us from the list. */ - error =xfs_itobp (mp, tp, ip, &dip, &ibp,XBF_LOCK ); + error =xfs_itobp (mp, tp, ip, &dip, &ibp,0 );if (error) {xfs_warn (mp,"%s: xfs_itobp(2) returned error %d." , __func__, error);
@@ -1566,8 +1565,7 @@ xfs_ifree_cluster(* to mark all the active inodes on the buffer stale. */ bp =xfs_trans_get_buf (tp, mp->m_ddev_targp, blkno, - mp->m_bsize * blks_per_cluster, -XBF_LOCK ); + mp->m_bsize * blks_per_cluster,0 );if (!bp)return ENOMEM ;
@@ -1737,7 +1735,7 @@ xfs_ifree(xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE ); - error =xfs_itobp (ip->i_mount, tp, ip, &dip, &ibp,XBF_LOCK ); + error =xfs_itobp (ip->i_mount, tp, ip, &dip, &ibp,0 );if (error)return error;
fs/xfs/xfs_log_recover.c +3 -4
@@ -2127,7 +2127,7 @@ xlog_recover_buffer_pass2(trace_xfs_log_recover_buf_recover (log, buf_f); - buf_flags =XBF_LOCK ; + buf_flags =0 ;if (!(buf_f->blf_flags &XFS_BLF_INODE_BUF )) buf_flags |=XBF_MAPPED ;
@@ -2225,8 +2225,7 @@ xlog_recover_inode_pass2( }trace_xfs_log_recover_inode_recover (log, in_f); - bp =xfs_buf_read (mp->m_ddev_targp, in_f->ilf_blkno, in_f->ilf_len, -XBF_LOCK ); + bp =xfs_buf_read (mp->m_ddev_targp, in_f->ilf_blkno, in_f->ilf_len,0 );if (!bp) { error =ENOMEM ; goto error;
@@ -3099,7 +3098,7 @@ xlog_recover_process_one_iunlink(/* * Get the on disk inode to find the next inode in the bucket. */ - error =xfs_itobp (mp,NULL , ip, &dip, &ibp,XBF_LOCK ); + error =xfs_itobp (mp,NULL , ip, &dip, &ibp,0 );if (error) goto fail_iput;
fs/xfs/xfs_rw.c +1 -1
@@ -114,7 +114,7 @@ xfs_read_buf(int error;if (!flags) - flags =XBF_LOCK |XBF_MAPPED ; + flags =XBF_MAPPED ; bp =xfs_buf_read (target, blkno, len, flags);if (!bp)
fs/xfs/xfs_trans_buf.c +2 -2
@@ -142,7 +142,7 @@ xfs_trans_get_buf(xfs_trans_t *tp,xfs_buf_log_item_t *bip;if (flags ==0 ) - flags =XBF_LOCK |XBF_MAPPED ; + flags =XBF_MAPPED ;/* * Default to a normal get_buf() call if the tp is NULL.
@@ -275,7 +275,7 @@ xfs_trans_read_buf(int error;if (flags ==0 ) - flags =XBF_LOCK |XBF_MAPPED ; + flags =XBF_MAPPED ;/* * Default to a normal get_buf() call if the tp is NULL.
fs/xfs/xfs_vnodeops.c +1 -1
@@ -82,7 +82,7 @@ xfs_readlink_bmap( byte_cnt =XFS_FSB_TO_B (mp, mval[n].br_blockcount); bp =xfs_buf_read (mp->m_ddev_targp, d,BTOBB (byte_cnt), -XBF_LOCK |XBF_MAPPED |XBF_DONT_BLOCK ); +XBF_MAPPED |XBF_DONT_BLOCK );if (!bp)return XFS_ERROR (ENOMEM ); error = bp->b_error;
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 25/37 xfs: kill xfs_read_buf()
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
xfs_read_buf() is effectively the same as xfs_trans_read_buf() when called outside a transaction context. The error handling is slightly different in that xfs_read_buf stales the errored buffer it gets back, but there is probably good reason for xfs_trans_read_buf() for doing this.
Hence update xfs_trans_read_buf() to the same error handling as xfs_read_buf(), and convert all the callers of xfs_read_buf() to use the former function. We can then remove xfs_read_buf().
--- fs/xfs/xfs_attr.c | 4 ++-- fs/xfs/xfs_fsops.c | 2 +- fs/xfs/xfs_log_recover.c | 11 ++++------ fs/xfs/xfs_rw.c | 50 ---------------------------------------------- fs/xfs/xfs_rw.h | 3 --- fs/xfs/xfs_trans_buf.c | 4 ++++ 6 files changed, 11 insertions(+), 63 deletions(-)
fs/xfs/xfs_attr.c +2 -2
@@ -1987,8 +1987,8 @@ xfs_attr_rmtval_get(xfs_da_args_t *args) (map[i].br_startblock != HOLESTARTBLOCK)); dblkno =XFS_FSB_TO_DADDR (mp, map[i].br_startblock); blkcnt =XFS_FSB_TO_BB (mp, map[i].br_blockcount); - error =xfs_read_buf (mp, mp->m_ddev_targp, dblkno, - blkcnt,XBF_DONT_BLOCK , &bp); + error =xfs_trans_read_buf (mp,NULL , mp->m_ddev_targp, + dblkno, blkcnt,0 , &bp);if (error)return (error);
fs/xfs/xfs_fsops.c +1 -1
@@ -402,7 +402,7 @@ xfs_growfs_data_private(/* update secondary superblocks. */ for (agno =1 ; agno < nagcount; agno++) { - error =xfs_read_buf (mp, mp->m_ddev_targp, + error =xfs_trans_read_buf (mp,NULL , mp->m_ddev_targp,XFS_AGB_TO_DADDR (mp, agno,XFS_SB_BLOCK (mp)),XFS_FSS_TO_BB (mp,1 ),0 , &bp);if (error) {
fs/xfs/xfs_log_recover.c +4 -7
@@ -2535,14 +2535,11 @@ xlog_recover_dquot_pass2(return XFS_ERROR (EIO );ASSERT (dq_f->qlf_len ==1 ); - error =xfs_read_buf (mp, mp->m_ddev_targp, - dq_f->qlf_blkno, -XFS_FSB_TO_BB (mp, dq_f->qlf_len), -0 , &bp); -if (error) { -xfs_buf_ioerror_alert (bp,"xlog_recover_do..(read#3)" ); + error =xfs_trans_read_buf (mp,NULL , mp->m_ddev_targp, dq_f->qlf_blkno, +XFS_FSB_TO_BB (mp, dq_f->qlf_len),0 , &bp); +if (error)return error; - } +ASSERT (bp); ddq = (xfs_disk_dquot_t *)xfs_buf_offset (bp, dq_f->qlf_boffset);
fs/xfs/xfs_rw.c +0 -50
56 lines not on this page · raw message
fs/xfs/xfs_rw.h +0 -3
@@ -39,9 +39,6 @@ xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb)/* * Prototypes for functions in xfs_rw.c. */ -extern int xfs_read_buf (struct xfs_mount *mp,xfs_buftarg_t *btp, -xfs_daddr_t blkno,int len,uint flags, -struct xfs_buf **bpp);extern xfs_extlen_t xfs_get_extsz_hint (struct xfs_inode *ip);#endif /* __XFS_RW_H__ */
fs/xfs/xfs_trans_buf.c +4 -0
@@ -274,6 +274,8 @@ xfs_trans_read_buf(xfs_buf_log_item_t *bip;int error; + *bpp =NULL ; +if (flags ==0 ) flags =XBF_MAPPED ;
@@ -289,6 +291,8 @@ xfs_trans_read_buf(if (bp->b_error) { error = bp->b_error;xfs_buf_ioerror_alert (bp, __func__); +XFS_BUF_UNDONE (bp); +xfs_buf_stale (bp);xfs_buf_relse (bp);return error; }
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 27/37 xfs: use iolock on XFS_IOC_ALLOCSP calls
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
fsstress has a particular effective way of stopping debug XFS kernels. We keep seeing assert failures due finding delayed allocation extents where there should be none. This shows up when extracting extent maps and we are holding all the locks we should be to prevent races, so this really makes no sense to see these errors.
After checking that fsstress does not use mmap, it occurred to me that fsstress uses something that no sane application uses - the XFS_IOC_ALLOCSP ioctl interfaces for preallocation. These interfaces do allocation of blocks beyond EOF without using preallocation, and then call setattr to extend and zero the allocated blocks.
THe problem here is this is a buffered write, and hence the allocation is a delayed allocation. Unlike the buffered IO path, the allocation and zeroing are not serialised using the IOLOCK. Hence the ALLOCSP operation can race with operations holding the iolock to prevent buffered IO operations from occurring.
--- fs/xfs/xfs_vnodeops.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
fs/xfs/xfs_vnodeops.c +19 -3
@@ -2315,17 +2315,33 @@ xfs_change_file_space(case XFS_IOC_ALLOCSP64 :case XFS_IOC_FREESP :case XFS_IOC_FREESP64 : +/* +* These operations actually do IO when extending the file, but +* the allocation is done seperately to the zeroing that is +* done. This set of operations need to be serialised against +* other IO operations, such as truncate and buffered IO. We +* need to take the IOLOCK here to serialise the allocation and +* zeroing IO to prevent other IOLOCK holders (e.g. getbmap, +* truncate, direct IO) from racing against the transient +* allocated but not written state we can have here. +*/ +xfs_ilock (ip,XFS_IOLOCK_EXCL );if (startoffset > fsize) { error =xfs_alloc_file_space (ip, fsize, - startoffset - fsize,0 , attr_flags); -if (error) + startoffset - fsize,0 , + attr_flags |XFS_ATTR_NOLOCK ); +if (error) { +xfs_iunlock (ip,XFS_IOLOCK_EXCL );break ; + } } iattr.ia_valid =ATTR_SIZE ; iattr.ia_size = startoffset; - error =xfs_setattr_size (ip, &iattr, attr_flags); + error =xfs_setattr_size (ip, &iattr, + attr_flags |XFS_ATTR_NOLOCK ); +xfs_iunlock (ip,XFS_IOLOCK_EXCL );if (error)return error;
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 30/37 xfs: clean up busy extent naming
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Now that the busy extent tracking has been moved out of the allocation files, clean up the namespace it uses to "xfs_extent_busy" rather than a mix of "xfs_busy" and "xfs_alloc_busy".
--- fs/xfs/xfs_alloc.c | 12 ++++---- fs/xfs/xfs_alloc_btree.c | 6 ++-- fs/xfs/xfs_discard.c | 4 +-- fs/xfs/xfs_extent_busy.c | 76 +++++++++++++++++++++++----------------------- fs/xfs/xfs_log_cil.c | 6 ++-- fs/xfs/xfs_trace.h | 16 +++++----- fs/xfs/xfs_trans.c | 4 +-- 7 files changed, 62 insertions(+), 62 deletions(-)
fs/xfs/xfs_alloc.c +6 -6
@@ -47,7 +47,7 @@ STATIC int xfs_alloc_ag_vextent_near(xfs_alloc_arg_t *); STATIC int xfs_alloc_ag_vextent_size(xfs_alloc_arg_t *); STATIC int xfs_alloc_ag_vextent_small(xfs_alloc_arg_t *,xfs_btree_cur_t *,xfs_agblock_t *,xfs_extlen_t *,int *); -STATIC void xfs_alloc_busy_trim(struct xfs_alloc_arg *, +STATIC void xfs_extent_busy_trim(struct xfs_alloc_arg *,xfs_agblock_t ,xfs_extlen_t ,xfs_agblock_t *,xfs_extlen_t *);/*
@@ -152,7 +152,7 @@ xfs_alloc_compute_aligned(xfs_extlen_t len;/* Trim busy sections out of found extent */ -xfs_alloc_busy_trim (args, foundbno, foundlen, &bno, &len); +xfs_extent_busy_trim (args, foundbno, foundlen, &bno, &len);if (args->alignment >1 && len >= args->minlen) {xfs_agblock_t aligned_bno =roundup (bno, args->alignment);
@@ -536,7 +536,7 @@ xfs_alloc_ag_vextent(if (error)return error; -ASSERT (!xfs_alloc_busy_search (args->mp, args->agno, +ASSERT (!xfs_extent_busy_search (args->mp, args->agno, args->agbno, args->len)); }
@@ -603,7 +603,7 @@ xfs_alloc_ag_vextent_exact(/* * Check for overlapping busy extents. */ -xfs_alloc_busy_trim (args, fbno, flen, &tbno, &tlen); +xfs_extent_busy_trim (args, fbno, flen, &tbno, &tlen);/* * Give up if the start of the extent is busy, or the freespace isn't
@@ -1391,7 +1391,7 @@ xfs_alloc_ag_vextent_small(if (error) goto error0;if (fbno !=NULLAGBLOCK ) { -xfs_alloc_busy_reuse (args->mp, args->agno, fbno,1 , +xfs_extent_busy_reuse (args->mp, args->agno, fbno,1 , args->userdata);if (args->userdata) {
@@ -2496,7 +2496,7 @@ xfs_free_extent( error =xfs_free_ag_extent (tp, args.agbp, args.agno, args.agbno, len,0 );if (!error) -xfs_alloc_busy_insert (tp, args.agno, args.agbno, len,0 ); +xfs_extent_busy_insert (tp, args.agno, args.agbno, len,0 ); error0:xfs_perag_put (args.pag);return error;
fs/xfs/xfs_alloc_btree.c +3 -3
@@ -94,7 +94,7 @@ xfs_allocbt_alloc_block(return 0 ; } -xfs_alloc_busy_reuse (cur->bc_mp, cur->bc_private.a.agno, bno,1 , false); +xfs_extent_busy_reuse (cur->bc_mp, cur->bc_private.a.agno, bno,1 , false);xfs_trans_agbtree_delta (cur->bc_tp,1 ); new->s =cpu_to_be32 (bno);
@@ -119,8 +119,8 @@ xfs_allocbt_free_block(if (error)return error; -xfs_alloc_busy_insert (cur->bc_tp,be32_to_cpu (agf->agf_seqno), bno,1 , -XFS_ALLOC_BUSY_SKIP_DISCARD ); +xfs_extent_busy_insert (cur->bc_tp,be32_to_cpu (agf->agf_seqno), bno,1 , +XFS_EXTENT_BUSY_SKIP_DISCARD );xfs_trans_agbtree_delta (cur->bc_tp,-1 );return 0 ; }
fs/xfs/xfs_discard.c +2 -2
@@ -118,7 +118,7 @@ xfs_trim_extents(* If any blocks in the range are still busy, skip the * discard and try again the next time. */ -if (xfs_alloc_busy_search (mp, agno, fbno, flen)) { +if (xfs_extent_busy_search (mp, agno, fbno, flen)) {trace_xfs_discard_busy (mp, agno, fbno, flen); goto next_extent; }
@@ -212,7 +212,7 @@ xfs_discard_extents(struct xfs_mount *mp, struct list_head *list) { - struct xfs_busy_extent *busyp; + struct xfs_extent_busy *busyp;int error =0 ;list_for_each_entry (busyp, list, list) {
fs/xfs/xfs_extent_busy.c +38 -38
241 lines not on this page · raw message
fs/xfs/xfs_log_cil.c +3 -3
@@ -338,8 +338,8 @@ xlog_cil_committed(xfs_trans_committed_bulk (ctx->cil->xc_log->l_ailp, ctx->lv_chain, ctx->start_lsn, abort); -xfs_alloc_busy_sort (&ctx->busy_extents); -xfs_alloc_busy_clear (mp, &ctx->busy_extents, +xfs_extent_busy_sort (&ctx->busy_extents); +xfs_extent_busy_clear (mp, &ctx->busy_extents, (mp->m_flags &XFS_MOUNT_DISCARD ) && !abort);spin_lock (&ctx->cil->xc_cil_lock);
@@ -352,7 +352,7 @@ xlog_cil_committed(ASSERT (mp->m_flags &XFS_MOUNT_DISCARD );xfs_discard_extents (mp, &ctx->busy_extents); -xfs_alloc_busy_clear (mp, &ctx->busy_extents, false); +xfs_extent_busy_clear (mp, &ctx->busy_extents, false); }kmem_free (ctx);
fs/xfs/xfs_trace.h +8 -8
@@ -1142,7 +1142,7 @@ TRACE_EVENT(xfs_bunmap, ); -DECLARE_EVENT_CLASS(xfs_busy_class, +DECLARE_EVENT_CLASS(xfs_extent_busy_class, TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno, xfs_extlen_t len), TP_ARGS(mp, agno, agbno, len),
@@ -1165,17 +1165,17 @@ DECLARE_EVENT_CLASS(xfs_busy_class, __entry->len) );#define DEFINE_BUSY_EVENT (name) \ -DEFINE_EVENT(xfs_busy_class, name, \ +DEFINE_EVENT(xfs_extent_busy_class, name, \ TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ xfs_agblock_t agbno, xfs_extlen_t len), \ TP_ARGS(mp, agno, agbno, len)) -DEFINE_BUSY_EVENT (xfs_alloc_busy); -DEFINE_BUSY_EVENT (xfs_alloc_busy_enomem); -DEFINE_BUSY_EVENT (xfs_alloc_busy_force); -DEFINE_BUSY_EVENT (xfs_alloc_busy_reuse); -DEFINE_BUSY_EVENT (xfs_alloc_busy_clear); +DEFINE_BUSY_EVENT (xfs_extent_busy); +DEFINE_BUSY_EVENT (xfs_extent_busy_enomem); +DEFINE_BUSY_EVENT (xfs_extent_busy_force); +DEFINE_BUSY_EVENT (xfs_extent_busy_reuse); +DEFINE_BUSY_EVENT (xfs_extent_busy_clear); -TRACE_EVENT(xfs_alloc_busy_trim, +TRACE_EVENT(xfs_extent_busy_trim, TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno, xfs_extlen_t len, xfs_agblock_t tbno, xfs_extlen_t tlen),
fs/xfs/xfs_trans.c +2 -2
@@ -613,8 +613,8 @@ STATIC voidxfs_trans_free ( struct xfs_trans *tp) { -xfs_alloc_busy_sort (&tp->t_busy); -xfs_alloc_busy_clear (tp->t_mountp, &tp->t_busy, false); +xfs_extent_busy_sort (&tp->t_busy); +xfs_extent_busy_clear (tp->t_mountp, &tp->t_busy, false);atomic_dec (&tp->t_mountp->m_active_trans);if (tp->t_flags &XFS_TRANS_FREEZE_PROT )
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 37/37 xfs: make XBF_MAPPED the default behaviour
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Rather than specifying XBF_MAPPED for almost all buffers, introduce XBF_UNMAPPED for the couple of users that use unmapped buffers.
--- fs/xfs/xfs_buf.c | 28 +++++++++++++--------------- fs/xfs/xfs_buf.h | 4 ++-- fs/xfs/xfs_fsops.c | 10 +++++----- fs/xfs/xfs_inode.c | 1 + fs/xfs/xfs_log_recover.c | 4 ++-- fs/xfs/xfs_trans_buf.c | 6 ------ fs/xfs/xfs_vnodeops.c | 3 +-- 7 files changed, 24 insertions(+), 32 deletions(-)
fs/xfs/xfs_buf.c +13 -15
@@ -65,11 +65,11 @@ xfs_buf_is_vmapped(/* * Return true if the buffer is vmapped. * -* The XBF_MAPPED flag is set if the buffer should be mapped, but the -* code is clever enough to know it doesn't have to map a single page, -* so the check has to be both for XBF_MAPPED and bp->b_page_count > 1. +* b_addr is null if the buffer is not mapped, but the code is clever +* enough to know it doesn't have to map a single page, so the check has +* to be both for b_addr and bp->b_page_count > 1. */ -return (bp->b_flags &XBF_MAPPED ) && bp->b_page_count >1 ; +return bp->b_addr && bp->b_page_count >1 ; } static inline int
@@ -181,7 +181,7 @@ xfs_buf_alloc(* We don't want certain flags to appear in b_flags unless they are * specifically set by later operations on the buffer. */ - flags &= ~(XBF_MAPPED |XBF_TRYLOCK |XBF_ASYNC |XBF_READ_AHEAD ); + flags &= ~(XBF_UNMAPPED |XBF_TRYLOCK |XBF_ASYNC |XBF_READ_AHEAD );atomic_set (&bp->b_hold,1 );atomic_set (&bp->b_lru_ref,1 );
@@ -329,7 +329,7 @@ xfs_buf_allocate_memory( bp->b_pages = bp->b_page_array; bp->b_pages[0 ] =virt_to_page (bp->b_addr); bp->b_page_count =1 ; - bp->b_flags |=XBF_MAPPED | _XBF_KMEM; + bp->b_flags |= _XBF_KMEM;return 0 ; }
@@ -399,8 +399,9 @@ _xfs_buf_map_pages(if (bp->b_page_count ==1 ) {/* A single page buffer is always mappable */ bp->b_addr =page_address (bp->b_pages[0 ]) + bp->b_offset; - bp->b_flags |=XBF_MAPPED ; - }else if (flags &XBF_MAPPED ) { + }else if (flags &XBF_UNMAPPED ) { + bp->b_addr =NULL ; + }else {int retried =0 ; do {
@@ -414,7 +415,6 @@ _xfs_buf_map_pages(if (!bp->b_addr)return -ENOMEM ; bp->b_addr += bp->b_offset; - bp->b_flags |=XBF_MAPPED ; }return 0 ;
@@ -520,7 +520,7 @@ found:*/ if (bp->b_flags &XBF_STALE ) {ASSERT ((bp->b_flags & _XBF_DELWRI_Q) ==0 ); - bp->b_flags &=XBF_MAPPED | _XBF_KMEM | _XBF_PAGES; + bp->b_flags &= _XBF_KMEM | _XBF_PAGES; }trace_xfs_buf_find (bp, flags, _RET_IP_);
@@ -575,7 +575,7 @@ xfs_buf_get( bp->b_io_length = bp->b_length; found: -if (!(bp->b_flags &XBF_MAPPED )) { +if (!bp->b_addr) { error =_xfs_buf_map_pages (bp, flags);if (unlikely (error)) { xfs_warn(target->bt_mount,
@@ -707,7 +707,6 @@ xfs_buf_set_empty( bp->b_length = numblks; bp->b_io_length = numblks; bp->b_bn =XFS_BUF_DADDR_NULL ; - bp->b_flags &= ~XBF_MAPPED ; } static inline struct page *
@@ -759,7 +758,6 @@ xfs_buf_associate_memory( bp->b_io_length =BTOBB (len); bp->b_length =BTOBB (buflen); - bp->b_flags |=XBF_MAPPED ;return 0 ; }
@@ -790,7 +788,7 @@ xfs_buf_get_uncached( } bp->b_flags |= _XBF_PAGES; - error =_xfs_buf_map_pages (bp,XBF_MAPPED ); + error =_xfs_buf_map_pages (bp,0 );if (unlikely (error)) {xfs_warn (target->bt_mount,"%s: failed to map pages\n" , __func__);
@@ -1287,7 +1285,7 @@ xfs_buf_offset( {struct page *page; -if (bp->b_flags &XBF_MAPPED ) +if (bp->b_addr)return bp->b_addr + offset; offset += bp->b_offset;
fs/xfs/xfs_buf.h +2 -2
@@ -41,7 +41,6 @@ typedef enum {#define XBF_READ (1 << 0)/* buffer intended for reading from device */ #define XBF_WRITE (1 << 1)/* buffer intended for writing to device */ #define XBF_READ_AHEAD (1 << 2)/* asynchronous read-ahead */ -#define XBF_MAPPED (1 << 3)/* buffer mapped (b_addr valid) */ #define XBF_ASYNC (1 << 4)/* initiator will not wait for completion */ #define XBF_DONE (1 << 5)/* all pages in the buffer uptodate */ #define XBF_STALE (1 << 6)/* buffer has been staled, do not find it */
@@ -53,6 +52,7 @@ typedef enum {/* flags used only as arguments to access routines */ #define XBF_TRYLOCK (1 << 16)/* lock requested, but do not wait */ +#define XBF_UNMAPPED (1 << 17)/* do not map the buffer */ /* flags used only internally */ #define _XBF_PAGES (1 << 20)/* backed by refcounted pages */
@@ -65,7 +65,6 @@ typedef unsigned int xfs_buf_flags_t; { XBF_READ, "READ" }, \ { XBF_WRITE, "WRITE" }, \ { XBF_READ_AHEAD, "READ_AHEAD" }, \ - { XBF_MAPPED, "MAPPED" }, \ { XBF_ASYNC, "ASYNC" }, \ { XBF_DONE, "DONE" }, \ { XBF_STALE, "STALE" }, \
@@ -73,6 +72,7 @@ typedef unsigned int xfs_buf_flags_t; { XBF_FUA, "FUA" }, \ { XBF_FLUSH, "FLUSH" }, \ { XBF_TRYLOCK, "TRYLOCK" }, /* should never be set */\ + { XBF_UNMAPPED, "UNMAPPED" }, /* ditto */\ { _XBF_PAGES, "PAGES" }, \ { _XBF_KMEM, "KMEM" }, \ { _XBF_DELWRI_Q, "DELWRI_Q" }
fs/xfs/xfs_fsops.c +5 -5
@@ -190,7 +190,7 @@ xfs_growfs_data_private(*/ bp =xfs_buf_get (mp->m_ddev_targp,XFS_AG_DADDR (mp, agno,XFS_AGF_DADDR (mp)), -XFS_FSS_TO_BB (mp,1 ),XBF_MAPPED ); +XFS_FSS_TO_BB (mp,1 ),0 );if (!bp) { error =ENOMEM ; goto error0;
@@ -227,7 +227,7 @@ xfs_growfs_data_private(*/ bp =xfs_buf_get (mp->m_ddev_targp,XFS_AG_DADDR (mp, agno,XFS_AGI_DADDR (mp)), -XFS_FSS_TO_BB (mp,1 ),XBF_MAPPED ); +XFS_FSS_TO_BB (mp,1 ),0 );if (!bp) { error =ENOMEM ; goto error0;
@@ -256,7 +256,7 @@ xfs_growfs_data_private(*/ bp =xfs_buf_get (mp->m_ddev_targp,XFS_AGB_TO_DADDR (mp, agno,XFS_BNO_BLOCK (mp)), -BTOBB (mp->m_sb.sb_blocksize),XBF_MAPPED ); +BTOBB (mp->m_sb.sb_blocksize),0 );if (!bp) { error =ENOMEM ; goto error0;
@@ -282,7 +282,7 @@ xfs_growfs_data_private(*/ bp =xfs_buf_get (mp->m_ddev_targp,XFS_AGB_TO_DADDR (mp, agno,XFS_CNT_BLOCK (mp)), -BTOBB (mp->m_sb.sb_blocksize),XBF_MAPPED ); +BTOBB (mp->m_sb.sb_blocksize),0 );if (!bp) { error =ENOMEM ; goto error0;
@@ -309,7 +309,7 @@ xfs_growfs_data_private(*/ bp =xfs_buf_get (mp->m_ddev_targp,XFS_AGB_TO_DADDR (mp, agno,XFS_IBT_BLOCK (mp)), -BTOBB (mp->m_sb.sb_blocksize),XBF_MAPPED ); +BTOBB (mp->m_sb.sb_blocksize),0 );if (!bp) { error =ENOMEM ; goto error0;
fs/xfs/xfs_inode.c +1 -0
@@ -150,6 +150,7 @@ xfs_imap_to_bp(int ni;xfs_buf_t *bp; + buf_flags |=XBF_UNMAPPED ; error =xfs_trans_read_buf (mp, tp, mp->m_ddev_targp, imap->im_blkno, (int )imap->im_len, buf_flags, &bp);if (error) {
fs/xfs/xfs_log_recover.c +2 -2
@@ -2127,8 +2127,8 @@ xlog_recover_buffer_pass2(trace_xfs_log_recover_buf_recover (log, buf_f); buf_flags =0 ; -if (!(buf_f->blf_flags &XFS_BLF_INODE_BUF )) - buf_flags |=XBF_MAPPED ; +if (buf_f->blf_flags &XFS_BLF_INODE_BUF ) + buf_flags |=XBF_UNMAPPED ; bp =xfs_buf_read (mp->m_ddev_targp, buf_f->blf_blkno, buf_f->blf_len, buf_flags);
fs/xfs/xfs_trans_buf.c +0 -6
@@ -138,9 +138,6 @@ xfs_trans_get_buf(xfs_trans_t *tp,xfs_buf_t *bp;xfs_buf_log_item_t *bip; -if (flags ==0 ) - flags =XBF_MAPPED ; -/* * Default to a normal get_buf() call if the tp is NULL. */
@@ -264,9 +261,6 @@ xfs_trans_read_buf( *bpp =NULL ; -if (flags ==0 ) - flags =XBF_MAPPED ; -/* * Default to a normal get_buf() call if the tp is NULL. */
fs/xfs/xfs_vnodeops.c +1 -2
@@ -79,8 +79,7 @@ xfs_readlink_bmap( d =XFS_FSB_TO_DADDR (mp, mval[n].br_startblock); byte_cnt =XFS_FSB_TO_B (mp, mval[n].br_blockcount); - bp =xfs_buf_read (mp->m_ddev_targp, d,BTOBB (byte_cnt), -XBF_MAPPED ); + bp =xfs_buf_read (mp->m_ddev_targp, d,BTOBB (byte_cnt),0 );if (!bp)return XFS_ERROR (ENOMEM ); error = bp->b_error;
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 26/37 xfs: kill XBF_DONTBLOCK
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Just about all callers of xfs_buf_read() and xfs_buf_get() use XBF_DONTBLOCK. This is used to make memory allocation use GFP_NOFS rather than GFP_KERNEL to avoid recursion through memory reclaim back into the filesystem.
All the blocking get calls in growfs occur inside a transaction, even though they are no part of the transaction, so all allocation will be GFP_NOFS due to the task flag PF_TRANS being set. The blocking read calls occur during log recovery, so they will probably be unaffected by converting to GFP_NOFS allocations.
Hence make XBF_DONTBLOCK behaviour always occur for buffers and kill the flag.
--- fs/xfs/xfs_attr.c | 3 +-- fs/xfs/xfs_buf.c | 18 +++++++----------- fs/xfs/xfs_buf.h | 2 -- fs/xfs/xfs_trans_buf.c | 25 ++++--------------------- fs/xfs/xfs_vnodeops.c | 4 ++-- 5 files changed, 14 insertions(+), 38 deletions(-)
fs/xfs/xfs_attr.c +1 -2
@@ -2114,8 +2114,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) dblkno =XFS_FSB_TO_DADDR (mp, map.br_startblock), blkcnt =XFS_FSB_TO_BB (mp, map.br_blockcount); - bp =xfs_buf_get (mp->m_ddev_targp, dblkno, blkcnt, -XBF_DONT_BLOCK ); + bp =xfs_buf_get (mp->m_ddev_targp, dblkno, blkcnt,0 );if (!bp)return ENOMEM ;
fs/xfs/xfs_buf.c +7 -11
@@ -56,11 +56,7 @@ static struct workqueue_struct *xfslogd_workqueue;#endif #define xb_to_gfp (flags) \ - ((((flags) & XBF_READ_AHEAD) ? __GFP_NORETRY : \ - ((flags) & XBF_DONT_BLOCK) ? GFP_NOFS : GFP_KERNEL) | __GFP_NOWARN) - -#define xb_to_km (flags) \ - (((flags) & XBF_DONT_BLOCK) ? KM_NOFS : KM_SLEEP) + ((((flags) & XBF_READ_AHEAD) ? __GFP_NORETRY : GFP_NOFS) | __GFP_NOWARN) static inline int
@@ -178,14 +174,14 @@ xfs_buf_alloc( {struct xfs_buf *bp; - bp =kmem_zone_zalloc (xfs_buf_zone,xb_to_km (flags)); + bp =kmem_zone_zalloc (xfs_buf_zone,KM_NOFS );if (unlikely (!bp))return NULL ;/* * We don't want certain flags to appear in b_flags. */ - flags &= ~(XBF_MAPPED |XBF_DONT_BLOCK |XBF_READ_AHEAD ); + flags &= ~(XBF_MAPPED |XBF_READ_AHEAD );atomic_set (&bp->b_hold,1 );atomic_set (&bp->b_lru_ref,1 );
@@ -239,7 +235,7 @@ _xfs_buf_get_pages( bp->b_pages = bp->b_page_array; }else { bp->b_pages =kmem_alloc (sizeof (struct page *) * - page_count,xb_to_km (flags)); + page_count,KM_NOFS );if (bp->b_pages ==NULL )return -ENOMEM ; }
@@ -316,7 +312,7 @@ xfs_buf_allocate_memory(*/ size =BBTOB (bp->b_length);if (size <PAGE_SIZE ) { - bp->b_addr =kmem_alloc (size,xb_to_km (flags)); + bp->b_addr =kmem_alloc (size,KM_NOFS );if (!bp->b_addr) {/* low memory - use alloc_page loop instead */ goto use_alloc_page;
@@ -659,7 +655,7 @@ xfs_buf_readahead(return ;xfs_buf_read (target, blkno, numblks, -XBF_TRYLOCK |XBF_ASYNC |XBF_READ_AHEAD |XBF_DONT_BLOCK ); +XBF_TRYLOCK |XBF_ASYNC |XBF_READ_AHEAD ); }/*
@@ -750,7 +746,7 @@ xfs_buf_associate_memory( bp->b_pages =NULL ; bp->b_addr = mem; - rval =_xfs_buf_get_pages (bp, page_count,XBF_DONT_BLOCK ); + rval =_xfs_buf_get_pages (bp, page_count,0 );if (rval)return rval;
fs/xfs/xfs_buf.h +0 -2
@@ -53,7 +53,6 @@ typedef enum {/* flags used only as arguments to access routines */ #define XBF_TRYLOCK (1 << 16)/* lock requested, but do not wait */ -#define XBF_DONT_BLOCK (1 << 17)/* do not block in current thread */ /* flags used only internally */ #define _XBF_PAGES (1 << 20)/* backed by refcounted pages */
@@ -74,7 +73,6 @@ typedef unsigned int xfs_buf_flags_t; { XBF_FUA, "FUA" }, \ { XBF_FLUSH, "FLUSH" }, \ { XBF_TRYLOCK, "TRYLOCK" }, /* should never be set */\ - { XBF_DONT_BLOCK, "DONT_BLOCK" }, /* ditto */\ { _XBF_PAGES, "PAGES" }, \ { _XBF_KMEM, "KMEM" }, \ { _XBF_DELWRI_Q, "DELWRI_Q" }
fs/xfs/xfs_trans_buf.c +4 -21
@@ -148,8 +148,7 @@ xfs_trans_get_buf(xfs_trans_t *tp,* Default to a normal get_buf() call if the tp is NULL. */ if (tp ==NULL ) -return xfs_buf_get (target_dev, blkno, len, - flags |XBF_DONT_BLOCK ); +return xfs_buf_get (target_dev, blkno, len, flags);/* * If we find the buffer in the cache with this transaction
@@ -174,15 +173,7 @@ xfs_trans_get_buf(xfs_trans_t *tp,return (bp); } -/* -* We always specify the XBF_DONT_BLOCK flag within a transaction -* so that get_buf does not try to push out a delayed write buffer -* which might cause another transaction to take place (if the -* buffer was delayed alloc). Such recursive transactions can -* easily deadlock with our current transaction as well as cause -* us to run out of stack space. -*/ - bp =xfs_buf_get (target_dev, blkno, len, flags |XBF_DONT_BLOCK ); + bp =xfs_buf_get (target_dev, blkno, len, flags);if (bp ==NULL ) {return NULL ; }
@@ -283,7 +274,7 @@ xfs_trans_read_buf(* Default to a normal get_buf() call if the tp is NULL. */ if (tp ==NULL ) { - bp =xfs_buf_read (target, blkno, len, flags |XBF_DONT_BLOCK ); + bp =xfs_buf_read (target, blkno, len, flags);if (!bp)return (flags &XBF_TRYLOCK ) ?EAGAIN :XFS_ERROR (ENOMEM );
@@ -367,15 +358,7 @@ xfs_trans_read_buf(return 0 ; } -/* -* We always specify the XBF_DONT_BLOCK flag within a transaction -* so that get_buf does not try to push out a delayed write buffer -* which might cause another transaction to take place (if the -* buffer was delayed alloc). Such recursive transactions can -* easily deadlock with our current transaction as well as cause -* us to run out of stack space. -*/ - bp =xfs_buf_read (target, blkno, len, flags |XBF_DONT_BLOCK ); + bp =xfs_buf_read (target, blkno, len, flags);if (bp ==NULL ) { *bpp =NULL ; return (flags & XBF_TRYLOCK) ?
fs/xfs/xfs_vnodeops.c +2 -2
@@ -82,7 +82,7 @@ xfs_readlink_bmap( byte_cnt =XFS_FSB_TO_B (mp, mval[n].br_blockcount); bp =xfs_buf_read (mp->m_ddev_targp, d,BTOBB (byte_cnt), -XBF_MAPPED |XBF_DONT_BLOCK ); +XBF_MAPPED );if (!bp)return XFS_ERROR (ENOMEM ); error = bp->b_error;
@@ -1966,7 +1966,7 @@ xfs_zero_remaining_bytes( bp =xfs_buf_get_uncached (XFS_IS_REALTIME_INODE (ip) ? mp->m_rtdev_targp : mp->m_ddev_targp, -BTOBB (mp->m_sb.sb_blocksize),XBF_DONT_BLOCK ); +BTOBB (mp->m_sb.sb_blocksize),0 );if (!bp)return XFS_ERROR (ENOMEM );
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 31/37 xfs: move xfs_fsb_to_db to xfs_bmap.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
This is the only remaining useful function in xfs_rw.h, so move it to a header file responsible for block mapping functions that the callers already include. Soon we can get rid of xfs_rw.h.
--- fs/xfs/xfs_bmap.c | 13 +++++++++++++ fs/xfs/xfs_bmap.h | 3 +++ fs/xfs/xfs_rw.h | 14 -------------- 3 files changed, 16 insertions(+), 14 deletions(-)
fs/xfs/xfs_bmap.c +13 -0
@@ -6157,3 +6157,16 @@ next_block:return error; } + +/* +* Convert the given file system block to a disk block. We have to treat it +* differently based on whether the file is a real time file or not, because the +* bmap code does. +*/ +xfs_daddr_t +xfs_fsb_to_db (struct xfs_inode *ip,xfs_fsblock_t fsb) +{ +return (XFS_IS_REALTIME_INODE (ip) ? \ + (xfs_daddr_t )XFS_FSB_TO_BB ((ip)->i_mount, (fsb)) : \ +XFS_FSB_TO_DADDR ((ip)->i_mount, (fsb))); +}
fs/xfs/xfs_bmap.h +3 -0
@@ -211,6 +211,9 @@ int xfs_bmap_count_blocks(struct xfs_trans *tp, struct xfs_inode *ip, int whichfork, int *count);int xfs_bmap_punch_delalloc_range (struct xfs_inode *ip,xfs_fileoff_t start_fsb,xfs_fileoff_t length); + +xfs_daddr_t xfs_fsb_to_db (struct xfs_inode *ip,xfs_fsblock_t fsb); +#endif /* __KERNEL__ */ #endif /* __XFS_BMAP_H__ */
fs/xfs/xfs_rw.h +0 -14
@@ -23,20 +23,6 @@ struct xfs_inode;struct xfs_mount ;/* -* Convert the given file system block to a disk block. -* We have to treat it differently based on whether the -* file is a real time file or not, because the bmap code -* does. -*/ -static inline xfs_daddr_t -xfs_fsb_to_db (struct xfs_inode *ip,xfs_fsblock_t fsb) -{ -return (XFS_IS_REALTIME_INODE (ip) ? \ - (xfs_daddr_t )XFS_FSB_TO_BB ((ip)->i_mount, (fsb)) : \ -XFS_FSB_TO_DADDR ((ip)->i_mount, (fsb))); -} - -/* * Prototypes for functions in xfs_rw.c. */ extern xfs_extlen_t xfs_get_extsz_hint (struct xfs_inode *ip);
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 32/37 xfs: move xfs_get_extsz_hint() and kill xfs_rw.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The only thing left in xfs_rw.h is a function prototype for an inode function. Move that to xfs_inode.h, and kill xfs_rw.h.
Also move the function implementing the prototype from xfs_rw.c to xfs_inode.c so we only have one function left in xfs_rw.c
--- fs/xfs/xfs_aops.c | 1 - fs/xfs/xfs_attr.c | 1 - fs/xfs/xfs_bmap.c | 1 - fs/xfs/xfs_fsops.c | 1 - fs/xfs/xfs_inode.c | 14 ++++++++++++++ fs/xfs/xfs_inode.h | 2 ++ fs/xfs/xfs_iomap.c | 1 - fs/xfs/xfs_iops.c | 1 - fs/xfs/xfs_log.c | 1 - fs/xfs/xfs_log_recover.c | 1 - fs/xfs/xfs_mount.c | 1 - fs/xfs/xfs_rtalloc.c | 1 - fs/xfs/xfs_rw.c | 15 --------------- fs/xfs/xfs_rw.h | 30 ------------------------------ fs/xfs/xfs_trans_buf.c | 1 - fs/xfs/xfs_vnodeops.c | 1 - 16 files changed, 16 insertions(+), 57 deletions(-) delete mode 100644 fs/xfs/xfs_rw.h
fs/xfs/xfs_aops.c +0 -1
@@ -28,7 +28,6 @@#include "xfs_inode_item.h" #include "xfs_alloc.h" #include "xfs_error.h" -#include "xfs_rw.h" #include "xfs_iomap.h" #include "xfs_vnodeops.h" #include "xfs_trace.h"
fs/xfs/xfs_attr.c +0 -1
@@ -38,7 +38,6 @@#include "xfs_error.h" #include "xfs_quota.h" #include "xfs_trans_space.h" -#include "xfs_rw.h" #include "xfs_vnodeops.h" #include "xfs_trace.h"
fs/xfs/xfs_bmap.c +0 -1
@@ -41,7 +41,6 @@#include "xfs_rtalloc.h" #include "xfs_error.h" #include "xfs_attr_leaf.h" -#include "xfs_rw.h" #include "xfs_quota.h" #include "xfs_trans_space.h" #include "xfs_buf_item.h"
fs/xfs/xfs_fsops.c +0 -1
@@ -38,7 +38,6 @@#include "xfs_itable.h" #include "xfs_trans_space.h" #include "xfs_rtalloc.h" -#include "xfs_rw.h" #include "xfs_filestream.h" #include "xfs_trace.h"
fs/xfs/xfs_inode.c +14 -0
@@ -61,6 +61,20 @@ STATIC int xfs_iformat_local(xfs_inode_t *, xfs_dinode_t *, int, int); STATIC int xfs_iformat_extents(xfs_inode_t *, xfs_dinode_t *, int); STATIC int xfs_iformat_btree(xfs_inode_t *, xfs_dinode_t *, int); +/* +* helper function to extract extent size hint from inode +*/ +xfs_extlen_t +xfs_get_extsz_hint ( +struct xfs_inode *ip) +{ +if ((ip->i_d.di_flags &XFS_DIFLAG_EXTSIZE ) && ip->i_d.di_extsize) +return ip->i_d.di_extsize; +if (XFS_IS_REALTIME_INODE (ip)) +return ip->i_mount->m_sb.sb_rextsize; +return 0 ; +} +#ifdef DEBUG /* * Make sure that the extents in the given memory buffer
fs/xfs/xfs_inode.h +2 -0
@@ -533,6 +533,8 @@ int xfs_iflush(struct xfs_inode *, struct xfs_buf **);void xfs_lock_inodes (xfs_inode_t **,int ,uint );void xfs_lock_two_inodes (xfs_inode_t *,xfs_inode_t *,uint ); +xfs_extlen_t xfs_get_extsz_hint (struct xfs_inode *ip); +#define IHOLD (ip) \ do { \ ASSERT(atomic_read(&VFS_I(ip)->i_count) > 0) ; \
fs/xfs/xfs_iomap.c +0 -1
@@ -36,7 +36,6 @@#include "xfs_rtalloc.h" #include "xfs_error.h" #include "xfs_itable.h" -#include "xfs_rw.h" #include "xfs_attr.h" #include "xfs_buf_item.h" #include "xfs_trans_space.h"
fs/xfs/xfs_iops.c +0 -1
@@ -33,7 +33,6 @@#include "xfs_rtalloc.h" #include "xfs_error.h" #include "xfs_itable.h" -#include "xfs_rw.h" #include "xfs_attr.h" #include "xfs_buf_item.h" #include "xfs_utils.h"
fs/xfs/xfs_log.c +0 -1
@@ -34,7 +34,6 @@#include "xfs_trans_priv.h" #include "xfs_dinode.h" #include "xfs_inode.h" -#include "xfs_rw.h" #include "xfs_trace.h" kmem_zone_t *xfs_log_ticket_zone;
fs/xfs/xfs_log_recover.c +0 -1
@@ -40,7 +40,6 @@#include "xfs_extfree_item.h" #include "xfs_trans_priv.h" #include "xfs_quota.h" -#include "xfs_rw.h" #include "xfs_utils.h" #include "xfs_trace.h"
fs/xfs/xfs_mount.c +0 -1
@@ -38,7 +38,6 @@#include "xfs_rtalloc.h" #include "xfs_bmap.h" #include "xfs_error.h" -#include "xfs_rw.h" #include "xfs_quota.h" #include "xfs_fsops.h" #include "xfs_utils.h"
fs/xfs/xfs_rtalloc.c +0 -1
@@ -33,7 +33,6 @@#include "xfs_rtalloc.h" #include "xfs_fsops.h" #include "xfs_error.h" -#include "xfs_rw.h" #include "xfs_inode_item.h" #include "xfs_trans_space.h" #include "xfs_utils.h"
fs/xfs/xfs_rw.c +0 -15
@@ -28,7 +28,6 @@#include "xfs_dinode.h" #include "xfs_inode.h" #include "xfs_error.h" -#include "xfs_rw.h" /* * Force a shutdown of the filesystem instantly while keeping
@@ -89,17 +88,3 @@ xfs_do_force_shutdown( "Please umount the filesystem and rectify the problem(s)"); } } - -/* -* helper function to extract extent size hint from inode -*/ -xfs_extlen_t -xfs_get_extsz_hint ( -struct xfs_inode *ip) -{ -if ((ip->i_d.di_flags &XFS_DIFLAG_EXTSIZE ) && ip->i_d.di_extsize) -return ip->i_d.di_extsize; -if (XFS_IS_REALTIME_INODE (ip)) -return ip->i_mount->m_sb.sb_rextsize; -return 0 ; -}
fs/xfs/xfs_rw.h deleted +0 -30
@@ -1,30 +0,0 @@ -/* -* Copyright (c) 2000-2006 Silicon Graphics, Inc. -* All Rights Reserved. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it would be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write the Free Software Foundation, -* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ -#ifndef __XFS_RW_H__ -#define __XFS_RW_H__ - -struct xfs_buf ; -struct xfs_inode ; -struct xfs_mount ; - -/* -* Prototypes for functions in xfs_rw.c. -*/ -extern xfs_extlen_t xfs_get_extsz_hint (struct xfs_inode *ip); - -#endif /* __XFS_RW_H__ */
fs/xfs/xfs_trans_buf.c +0 -1
@@ -32,7 +32,6 @@#include "xfs_buf_item.h" #include "xfs_trans_priv.h" #include "xfs_error.h" -#include "xfs_rw.h" #include "xfs_trace.h" /*
fs/xfs/xfs_vnodeops.c +0 -1
@@ -38,7 +38,6 @@#include "xfs_bmap.h" #include "xfs_acl.h" #include "xfs_attr.h" -#include "xfs_rw.h" #include "xfs_error.h" #include "xfs_quota.h" #include "xfs_utils.h"
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 36/37 xfs: flush outstanding buffers on log mount failure
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
When we fail to mount the log in xfs_mountfs(), we tear down all the infrastructure we have already allocated. However, the process of mounting the log may have progressed to the point of reading, caching and modifying buffers in memory. Hence before we can free all the infrastructure, we have to flush and remove all the buffers from memory.
Problem first reported by Eric Sandeen, later a different incarnation was reported by Ben Myers.
--- fs/xfs/xfs_mount.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/xfs/xfs_mount.c +6 -2
@@ -1288,7 +1288,7 @@ xfs_mountfs( XFS_FSB_TO_BB(mp, sbp->sb_logblocks));if (error) {xfs_warn (mp,"log mount failed" ); - goto out_free_perag; + goto out_fail_wait; }/*
@@ -1315,7 +1315,7 @@ xfs_mountfs( !mp->m_sb.sb_inprogress) { error =xfs_initialize_perag_data (mp, sbp->sb_agcount);if (error) - goto out_free_perag; + goto out_fail_wait; }/*
@@ -1439,6 +1439,10 @@ xfs_mountfs(IRELE (rip); out_log_dealloc:xfs_log_unmount (mp); + out_fail_wait: +if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) +xfs_wait_buftarg (mp->m_logdev_targp); +xfs_wait_buftarg (mp->m_ddev_targp); out_free_perag:xfs_free_perag (mp); out_remove_uuid:
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 29/37 xfs: move busy extent handling to it's own file
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
To make it easier to handle userspace code merges, move all the busy extent handling out of the allocation code and into it's own file. The userspace code does not need the busy extent code, so this simplifies the merging of the kernel code into the userspace xfsprogs library.
Because the busy extent code has been almost completely rewritten over the past couple of years, also update the copyright on this new file to include the authors that made all those changes.
--- fs/xfs/Makefile | 1 + fs/xfs/xfs_ag.h | 18 -- fs/xfs/xfs_alloc.c | 572 +------------------------------------------ fs/xfs/xfs_alloc.h | 28 --- fs/xfs/xfs_alloc_btree.c | 1 + fs/xfs/xfs_discard.c | 1 + fs/xfs/xfs_extent_busy.c | 603 ++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_log_cil.c | 1 + fs/xfs/xfs_trans.c | 1 + 9 files changed, 609 insertions(+), 617 deletions(-) create mode 100644 fs/xfs/xfs_extent_busy.c
fs/xfs/Makefile +1 -0
@@ -33,6 +33,7 @@ xfs-y += xfs_aops.o \ xfs_discard.o \ xfs_error.o \ xfs_export.o \ + xfs_extent_busy.o \ xfs_file.o \ xfs_filestream.o \ xfs_fsops.o \
fs/xfs/xfs_ag.h +0 -18
@@ -175,24 +175,6 @@ typedef struct xfs_agfl { } xfs_agfl_t;/* -* Busy block/extent entry. Indexed by a rbtree in perag to mark blocks that -* have been freed but whose transactions aren't committed to disk yet. -* -* Note that we use the transaction ID to record the transaction, not the -* transaction structure itself. See xfs_alloc_busy_insert() for details. -*/ -struct xfs_busy_extent { -struct rb_node rb_node;/* ag by-bno indexed search tree */ -struct list_head list;/* transaction busy extent list */ -xfs_agnumber_t agno; -xfs_agblock_t bno; -xfs_extlen_t length; -unsigned int flags; -#define XFS_ALLOC_BUSY_DISCARDED 0x01/* undergoing a discard op. */ -#define XFS_ALLOC_BUSY_SKIP_DISCARD 0x02/* do not discard */ -}; - -/* * Per-ag incore structure, copies of information in agf and agi, * to improve the performance of allocation group selection. */
fs/xfs/xfs_alloc.c +1 -571
581 lines not on this page · raw message
fs/xfs/xfs_alloc.h +0 -28
@@ -23,7 +23,6 @@ struct xfs_btree_cur;struct xfs_mount ;struct xfs_perag ;struct xfs_trans ; -struct xfs_busy_extent ;extern struct workqueue_struct *xfs_alloc_wq;
@@ -139,33 +138,6 @@ xfs_extlen_t xfs_alloc_longest_free_extent(struct xfs_mount *mp, struct xfs_perag *pag); -#ifdef __KERNEL__ -void -xfs_alloc_busy_insert (struct xfs_trans *tp,xfs_agnumber_t agno, -xfs_agblock_t bno,xfs_extlen_t len,unsigned int flags); - -void -xfs_alloc_busy_clear (struct xfs_mount *mp,struct list_head *list, -bool do_discard); - -int -xfs_alloc_busy_search (struct xfs_mount *mp,xfs_agnumber_t agno, -xfs_agblock_t bno,xfs_extlen_t len); - -void -xfs_alloc_busy_reuse (struct xfs_mount *mp,xfs_agnumber_t agno, -xfs_agblock_t fbno,xfs_extlen_t flen,bool userdata); - -int -xfs_busy_extent_ag_cmp (void *priv,struct list_head *a,struct list_head *b); - -static inline void xfs_alloc_busy_sort (struct list_head *list) -{ -list_sort (NULL , list, xfs_busy_extent_ag_cmp); -} - -#endif /* __KERNEL__ */ -/* * Compute and fill in value of m_ag_maxlevels. */
fs/xfs/xfs_alloc_btree.c +1 -0
@@ -31,6 +31,7 @@#include "xfs_inode.h" #include "xfs_btree.h" #include "xfs_alloc.h" +#include "xfs_extent_busy.h" #include "xfs_error.h" #include "xfs_trace.h"
fs/xfs/xfs_discard.c +1 -0
@@ -29,6 +29,7 @@#include "xfs_inode.h" #include "xfs_alloc.h" #include "xfs_error.h" +#include "xfs_extent_busy.h" #include "xfs_discard.h" #include "xfs_trace.h"
fs/xfs/xfs_extent_busy.c new file +603 -0
603 lines not on this page · raw message
fs/xfs/xfs_log_cil.c +1 -0
@@ -28,6 +28,7 @@#include "xfs_mount.h" #include "xfs_error.h" #include "xfs_alloc.h" +#include "xfs_extent_busy.h" #include "xfs_discard.h" /*
fs/xfs/xfs_trans.c +1 -0
@@ -35,6 +35,7 @@#include "xfs_btree.h" #include "xfs_ialloc.h" #include "xfs_alloc.h" +#include "xfs_extent_busy.h" #include "xfs_bmap.h" #include "xfs_quota.h" #include "xfs_trans_priv.h"
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 34/37 xfs: clean up xfs_bit.h includes
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
With the removal of xfs_rw.h and other changes over time, xfs_bit.h is being included in many files that don't actually need it. Clean up the includes as necessary.
Also move the only-used-once xfs_ialloc_find_free() static inline function out of a header file that is widely included to reduce the number of needless dependencies on xfs_bit.h.
--- fs/xfs/xfs_alloc_btree.c | 1 - fs/xfs/xfs_aops.c | 1 - fs/xfs/xfs_dfrag.c | 1 - fs/xfs/xfs_dir2.c | 1 - fs/xfs/xfs_dquot_item.c | 1 - fs/xfs/xfs_file.c | 1 - fs/xfs/xfs_fsops.c | 1 - fs/xfs/xfs_ialloc.c | 7 +++++++ fs/xfs/xfs_ialloc.h | 9 --------- fs/xfs/xfs_iget.c | 1 - fs/xfs/xfs_inode.c | 1 - fs/xfs/xfs_inode_item.c | 1 - fs/xfs/xfs_ioctl.c | 1 - fs/xfs/xfs_ioctl32.c | 1 - fs/xfs/xfs_iomap.c | 1 - fs/xfs/xfs_iops.c | 1 - fs/xfs/xfs_itable.c | 1 - fs/xfs/xfs_log.c | 1 - fs/xfs/xfs_log_cil.c | 1 - fs/xfs/xfs_qm_bhv.c | 1 - fs/xfs/xfs_super.c | 1 - fs/xfs/xfs_sync.c | 1 - fs/xfs/xfs_trace.c | 1 - fs/xfs/xfs_trans.c | 1 - fs/xfs/xfs_trans_buf.c | 1 - fs/xfs/xfs_trans_dquot.c | 1 - fs/xfs/xfs_trans_inode.c | 1 - fs/xfs/xfs_utils.c | 1 - 28 files changed, 7 insertions(+), 35 deletions(-)
fs/xfs/xfs_alloc_btree.c +0 -1
@@ -18,7 +18,6 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_aops.c +0 -1
@@ -16,7 +16,6 @@* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "xfs.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_dfrag.c +0 -1
@@ -18,7 +18,6 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_dir2.c +0 -1
@@ -18,7 +18,6 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_inum.h" #include "xfs_trans.h"
fs/xfs/xfs_dquot_item.c +0 -1
@@ -17,7 +17,6 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_file.c +0 -1
@@ -17,7 +17,6 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_fsops.c +0 -1
@@ -18,7 +18,6 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_ialloc.c +7 -0
@@ -609,6 +609,13 @@ xfs_ialloc_get_rec(/* * Visible inode allocation functions. */ +/* +* Find a free (set) bit in the inode bitmask. +*/ +static inline int xfs_ialloc_find_free (xfs_inofree_t *fp) +{ +return xfs_lowbit64 (*fp); +}/* * Allocate an inode on disk.
fs/xfs/xfs_ialloc.h +0 -9
@@ -47,15 +47,6 @@ xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o) }/* -* Find a free (set) bit in the inode bitmask. -*/ -static inline int xfs_ialloc_find_free (xfs_inofree_t *fp) -{ -return xfs_lowbit64 (*fp); -} - - -/* * Allocate an inode on disk. * Mode is used to tell whether the new inode will need space, and whether * it is a directory.
fs/xfs/xfs_iget.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_types.h" #include "xfs_acl.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_inum.h" #include "xfs_trans.h"
fs/xfs/xfs_inode.c +0 -1
@@ -20,7 +20,6 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_inum.h" #include "xfs_trans.h"
fs/xfs/xfs_inode_item.c +0 -1
@@ -18,7 +18,6 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_ioctl.c +0 -1
@@ -17,7 +17,6 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_ioctl32.c +0 -1
@@ -22,7 +22,6 @@#include <asm/uaccess.h> #include "xfs.h" #include "xfs_fs.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_iomap.c +0 -1
@@ -17,7 +17,6 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_iops.c +0 -1
@@ -18,7 +18,6 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_acl.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_itable.c +0 -1
@@ -18,7 +18,6 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_inum.h" #include "xfs_trans.h"
fs/xfs/xfs_log.c +0 -1
@@ -18,7 +18,6 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_log_cil.c +0 -1
@@ -18,7 +18,6 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_trans_priv.h"
fs/xfs/xfs_qm_bhv.c +0 -1
@@ -17,7 +17,6 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_super.c +0 -1
@@ -17,7 +17,6 @@*/ #include "xfs.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_inum.h" #include "xfs_trans.h"
fs/xfs/xfs_sync.c +0 -1
@@ -18,7 +18,6 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_inum.h" #include "xfs_trans.h"
fs/xfs/xfs_trace.c +0 -1
@@ -18,7 +18,6 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_trans.c +0 -1
@@ -19,7 +19,6 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_trans_buf.c +0 -1
@@ -18,7 +18,6 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_trans_dquot.c +0 -1
@@ -17,7 +17,6 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_trans_inode.c +0 -1
@@ -18,7 +18,6 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_utils.c +0 -1
@@ -18,7 +18,6 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" -#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 35/37 xfs: Properly exclude IO type flags from buffer flags
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Recent event tracing during a debugging session showed that flags that define the IO type for a buffer are leaking into the flags on the buffer incorrectly. Fix the flag exclusion mask in xfs_buf_alloc() to avoid problems that may be caused by such leakage.
--- fs/xfs/xfs_buf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/xfs/xfs_buf.c +3 -2
@@ -178,9 +178,10 @@ xfs_buf_alloc(return NULL ;/* -* We don't want certain flags to appear in b_flags. +* We don't want certain flags to appear in b_flags unless they are +* specifically set by later operations on the buffer. */ - flags &= ~(XBF_MAPPED |XBF_READ_AHEAD ); + flags &= ~(XBF_MAPPED |XBF_TRYLOCK |XBF_ASYNC |XBF_READ_AHEAD );atomic_set (&bp->b_hold,1 );atomic_set (&bp->b_lru_ref,1 );
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 28/37 xfs: move xfsagino_t to xfs_types.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Untangle the header file includes a bit by moving the definition of xfs_agino_t to xfs_types.h. This removes the dependency that xfs_ag.h has on xfs_inum.h, meaning we don't need to include xfs_inum.h everywhere we include xfs_ag.h.
--- fs/xfs/xfs_alloc.c | 1 - fs/xfs/xfs_alloc_btree.c | 1 - fs/xfs/xfs_aops.c | 1 - fs/xfs/xfs_attr.c | 1 - fs/xfs/xfs_attr_leaf.c | 1 - fs/xfs/xfs_bmap_btree.c | 1 - fs/xfs/xfs_btree.c | 1 - fs/xfs/xfs_buf.c | 1 - fs/xfs/xfs_buf_item.c | 1 - fs/xfs/xfs_da_btree.c | 1 - fs/xfs/xfs_dfrag.c | 1 - fs/xfs/xfs_dir2_block.c | 1 - fs/xfs/xfs_dir2_data.c | 1 - fs/xfs/xfs_dir2_leaf.c | 1 - fs/xfs/xfs_dir2_node.c | 1 - fs/xfs/xfs_dir2_sf.c | 1 - fs/xfs/xfs_discard.c | 1 - fs/xfs/xfs_dquot.c | 1 - fs/xfs/xfs_dquot_item.c | 1 - fs/xfs/xfs_error.c | 1 - fs/xfs/xfs_export.c | 1 - fs/xfs/xfs_extfree_item.c | 1 - fs/xfs/xfs_file.c | 1 - fs/xfs/xfs_fsops.c | 1 - fs/xfs/xfs_ialloc_btree.c | 1 - fs/xfs/xfs_inode_item.c | 1 - fs/xfs/xfs_inum.h | 5 ----- fs/xfs/xfs_ioctl.c | 1 - fs/xfs/xfs_ioctl32.c | 1 - fs/xfs/xfs_iomap.c | 1 - fs/xfs/xfs_iops.c | 1 - fs/xfs/xfs_log.c | 1 - fs/xfs/xfs_log_cil.c | 1 - fs/xfs/xfs_message.c | 1 - fs/xfs/xfs_qm.c | 1 - fs/xfs/xfs_qm_bhv.c | 1 - fs/xfs/xfs_qm_syscalls.c | 1 - fs/xfs/xfs_quotaops.c | 1 - fs/xfs/xfs_rename.c | 1 - fs/xfs/xfs_rtalloc.c | 1 - fs/xfs/xfs_rw.c | 1 - fs/xfs/xfs_trace.c | 1 - fs/xfs/xfs_trans.c | 1 - fs/xfs/xfs_trans_ail.c | 1 - fs/xfs/xfs_trans_buf.c | 1 - fs/xfs/xfs_trans_dquot.c | 1 - fs/xfs/xfs_trans_extfree.c | 1 - fs/xfs/xfs_trans_inode.c | 1 - fs/xfs/xfs_types.h | 5 +++++ fs/xfs/xfs_utils.c | 1 - fs/xfs/xfs_vnodeops.c | 1 - 51 files changed, 5 insertions(+), 54 deletions(-)
fs/xfs/xfs_alloc.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_alloc_btree.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_aops.c +0 -1
@@ -18,7 +18,6 @@#include "xfs.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_sb.h" #include "xfs_ag.h" #include "xfs_trans.h"
fs/xfs/xfs_attr.c +0 -1
@@ -21,7 +21,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_attr_leaf.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_bmap_btree.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_btree.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_buf.c +0 -1
@@ -35,7 +35,6 @@#include <linux/freezer.h> #include "xfs_sb.h" -#include "xfs_inum.h" #include "xfs_log.h" #include "xfs_ag.h" #include "xfs_mount.h"
fs/xfs/xfs_buf_item.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_da_btree.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_dfrag.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_dir2_block.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_types.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_dir2_data.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_types.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_dir2_leaf.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_dir2_node.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_types.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_dir2_sf.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_types.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_discard.c +0 -1
@@ -17,7 +17,6 @@*/ #include "xfs.h" #include "xfs_sb.h" -#include "xfs_inum.h" #include "xfs_log.h" #include "xfs_ag.h" #include "xfs_mount.h"
fs/xfs/xfs_dquot.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_dquot_item.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_error.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_types.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_export.c +0 -1
@@ -17,7 +17,6 @@*/ #include "xfs.h" #include "xfs_types.h" -#include "xfs_inum.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_extfree_item.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_types.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_buf_item.h" #include "xfs_sb.h"
fs/xfs/xfs_file.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_sb.h" #include "xfs_ag.h" #include "xfs_trans.h"
fs/xfs/xfs_fsops.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_types.h" #include "xfs_bit.h" -#include "xfs_inum.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_ialloc_btree.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_inode_item.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_inum.h +0 -5
@@ -26,11 +26,6 @@* high agno_log-agblklog-inopblog bits - 0 */ -typedef __uint32_t xfs_agino_t ;/* within allocation grp inode number */ - -#define NULLFSINO ((xfs_ino_t)-1) -#define NULLAGINO ((xfs_agino_t)-1) -struct xfs_mount ;#define XFS_INO_MASK (k) (__uint32_t)((1ULL << (k)) - 1)
fs/xfs/xfs_ioctl.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_ioctl32.c +0 -1
@@ -24,7 +24,6 @@#include "xfs_fs.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_iomap.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_iops.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_acl.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_log.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_log_cil.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_trans_priv.h" #include "xfs_log_priv.h"
fs/xfs/xfs_message.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_types.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_qm.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_qm_bhv.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_qm_syscalls.c +0 -1
@@ -22,7 +22,6 @@#include "xfs_fs.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_quotaops.c +0 -1
@@ -17,7 +17,6 @@*/ #include "xfs.h" #include "xfs_sb.h" -#include "xfs_inum.h" #include "xfs_log.h" #include "xfs_ag.h" #include "xfs_mount.h"
fs/xfs/xfs_rename.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_types.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_rtalloc.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_rw.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_trace.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_trans.c +0 -1
@@ -21,7 +21,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_trans_ail.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_fs.h" #include "xfs_types.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_trans_buf.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_trans_dquot.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_trans_extfree.c +0 -1
@@ -19,7 +19,6 @@#include "xfs_fs.h" #include "xfs_types.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_trans_inode.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_types.h +5 -0
@@ -57,6 +57,7 @@ typedef __uint64_t __psunsigned_t;#endif /* __KERNEL__ */ typedef __uint32_t xfs_agblock_t ;/* blockno in alloc. group */ +typedef __uint32_t xfs_agino_t ;/* inode # within allocation grp */ typedef __uint32_t xfs_extlen_t ;/* extent length in blocks */ typedef __uint32_t xfs_agnumber_t ;/* allocation group number */ typedef __int32_t xfs_extnum_t ;/* # of extents in a file */
@@ -101,6 +102,7 @@ typedef __uint64_t xfs_fileoff_t; /* block number in a file */typedef __int64_t xfs_sfiloff_t ;/* signed block number in a file */ typedef __uint64_t xfs_filblks_t ;/* number of blocks in a file */ +/* * Null values for the types. */
@@ -120,6 +122,9 @@ typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */#define NULLCOMMITLSN ((xfs_lsn_t)-1) +#define NULLFSINO ((xfs_ino_t)-1) +#define NULLAGINO ((xfs_agino_t)-1) +/* * Max values for extlen, extnum, aextnum. */
fs/xfs/xfs_utils.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
fs/xfs/xfs_vnodeops.c +0 -1
@@ -21,7 +21,6 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h"
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH v2 12/37 xfs: Do background CIL flushes via a workqueue
In reply to Dave ChinnerQuoted 19 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Doing background CIL flushes adds significant latency to whatever async transaction that triggers it. To avoid blocking async transactions on things like waiting for log buffer IO to complete, move the CIL push off into a workqueue. By moving the push work into a workqueue, we remove all the latency that the commit adds from the foreground transaction commit path. This also means that single threaded workloads won't do the CIL push procssing, leaving them more CPU to do more async transactions.
To do this, we need to keep track of the sequence number we have pushed work for. This avoids having many transaction commits attempting to schedule work for the same sequence, and ensures that we only ever have one push (background or forced) in progress at a time. It also means that we don't need to take the CIL lock in write mode to check for potential background push races, which reduces lock contention.
Quoted 5 lines
To avoid potential issues with "smart" IO schedulers, don't use the workqueue for log force triggered flushes. Instead, do them directly so that the log IO is done directly by the process issuing the log force and so doesn't get stuck on IO elevator queue idling incorrectly delaying the log IO from the workqueue.
I think I understand what is triggering this ASSERT:
ASSERT(push_seq > 0 && push_seq <= ctx->sequence);
as the condition that is triggering is push_seq = 0.
Basically, the situation where the CIL is empty when a push is executed causes the xc_push_seq to be set to zero so that a subsequent push of that sequence number can be flushed. i.e. if there is force when tehre is no dirty items, the sequence number is not incremented as tehre is no commit, and hence if have subsequent modifications on that sequence number we need to be able to force it again. Resetting the push_seq is how that is acheived. If we get a push with a zero sequence number, the code actually handles that just fine by ignoring it. So, effectively, the assert for push_seq > no longer valid so it should just be removed.
It does, however, point out one thing - that we can be queuing multiple works when we don't need to, so we also need to check for whether we need to push based on the current sequence number in the background push check. the updated patch below addresses both these issues.
Cheers,
Dave.
Signature · 39 lines
Dave Chinner [email protected] xfs: Do background CIL flushes via a workqueue From: Dave Chinner <[email protected]> Doing background CIL flushes adds significant latency to whatever async transaction that triggers it. To avoid blocking async transactions on things like waiting for log buffer IO to complete, move the CIL push off into a workqueue. By moving the push work into a workqueue, we remove all the latency that the commit adds from the foreground transaction commit path. This also means that single threaded workloads won't do the CIL push procssing, leaving them more CPU to do more async transactions. To do this, we need to keep track of the sequence number we have pushed work for. This avoids having many transaction commits attempting to schedule work for the same sequence, and ensures that we only ever have one push (background or forced) in progress at a time. It also means that we don't need to take the CIL lock in write mode to check for potential background push races, which reduces lock contention. To avoid potential issues with "smart" IO schedulers, don't use the workqueue for log force triggered flushes. Instead, do them directly so that the log IO is done directly by the process issuing the log force and so doesn't get stuck on IO elevator queue idling incorrectly delaying the log IO from the workqueue. Signed-off-by: Dave Chinner <[email protected]> Reviewed-by: Mark Tinguely <[email protected]> --- fs/xfs/xfs_log_cil.c | 244 ++++++++++++++++++++++++++++++------------------- fs/xfs/xfs_log_priv.h | 2 + fs/xfs/xfs_mount.h | 1 + fs/xfs/xfs_super.c | 7 ++ 4 files changed, 160 insertions(+), 94 deletions(-)
fs/xfs/xfs_log_cil.c +150 -94
@@ -32,58 +32,6 @@#include "xfs_discard.h" /* -* Perform initial CIL structure initialisation. -*/ -int -xlog_cil_init ( -struct log *log) -{ -struct xfs_cil *cil; -struct xfs_cil_ctx *ctx; - - cil =kmem_zalloc (sizeof (*cil),KM_SLEEP |KM_MAYFAIL ); -if (!cil) -return ENOMEM ; - - ctx =kmem_zalloc (sizeof (*ctx),KM_SLEEP |KM_MAYFAIL ); -if (!ctx) { -kmem_free (cil); -return ENOMEM ; - } - -INIT_LIST_HEAD (&cil->xc_cil); -INIT_LIST_HEAD (&cil->xc_committing); -spin_lock_init (&cil->xc_cil_lock); -init_rwsem (&cil->xc_ctx_lock); -init_waitqueue_head (&cil->xc_commit_wait); - -INIT_LIST_HEAD (&ctx->committing); -INIT_LIST_HEAD (&ctx->busy_extents); - ctx->sequence =1 ; - ctx->cil = cil; - cil->xc_ctx = ctx; - cil->xc_current_sequence = ctx->sequence; - - cil->xc_log = log; - log->l_cilp = cil; -return 0 ; -} - -void -xlog_cil_destroy ( -struct log *log) -{ -if (log->l_cilp->xc_ctx) { -if (log->l_cilp->xc_ctx->ticket) -xfs_log_ticket_put (log->l_cilp->xc_ctx->ticket); -kmem_free (log->l_cilp->xc_ctx); - } - -ASSERT (list_empty (&log->l_cilp->xc_cil)); -kmem_free (log->l_cilp); -} - -/* * Allocate a new ticket. Failing to get a new ticket makes it really hard to * recover, so we don't allow failure here. Also, we allocate in a context that * we don't want to be issuing transactions from, so we need to tell the
@@ -426,8 +374,7 @@ xlog_cil_committed(*/ STATIC intxlog_cil_push ( -struct log *log, -xfs_lsn_t push_seq) +struct log *log) {struct xfs_cil *cil = log->l_cilp;struct xfs_log_vec *lv;
@@ -443,39 +390,36 @@ xlog_cil_push(struct xfs_log_iovec lhdr;struct xfs_log_vec lvhdr = {NULL };xfs_lsn_t commit_lsn; +xfs_lsn_t push_seq;if (!cil)return 0 ; -ASSERT (!push_seq || push_seq <= cil->xc_ctx->sequence); - new_ctx =kmem_zalloc (sizeof (*new_ctx),KM_SLEEP |KM_NOFS ); new_ctx->ticket =xlog_cil_ticket_alloc (log); -/* -* Lock out transaction commit, but don't block for background pushes -* unless we are well over the CIL space limit. See the definition of -* XLOG_CIL_HARD_SPACE_LIMIT() for the full explanation of the logic -* used here. -*/ -if (!down_write_trylock (&cil->xc_ctx_lock)) { -if (!push_seq && - cil->xc_ctx->space_used <XLOG_CIL_HARD_SPACE_LIMIT (log)) - goto out_free_ticket; -down_write (&cil->xc_ctx_lock); - } +down_write (&cil->xc_ctx_lock); ctx = cil->xc_ctx; -/* check if we've anything to push */ -if (list_empty (&cil->xc_cil)) - goto out_skip; +spin_lock (&cil->xc_cil_lock); + push_seq = cil->xc_push_seq; +ASSERT (push_seq <= ctx->sequence); -/* check for spurious background flush */ -if (!push_seq && cil->xc_ctx->space_used <XLOG_CIL_SPACE_LIMIT (log)) +/* +* Check if we've anything to push. If there is nothing, then we don't +* move on to a new sequence number and so we have to be able to push +* this sequence again later. +*/ +if (list_empty (&cil->xc_cil)) { + cil->xc_push_seq =0 ; +spin_unlock (&cil->xc_cil_lock); goto out_skip; + } +spin_unlock (&cil->xc_cil_lock); +/* check for a previously pushed seqeunce */ -if (push_seq && push_seq < cil->xc_ctx->sequence) +if (push_seq < cil->xc_ctx->sequence) goto out_skip;/*
@@ -629,7 +573,6 @@ restart: out_skip:up_write (&cil->xc_ctx_lock); -out_free_ticket:xfs_log_ticket_put (new_ctx->ticket);kmem_free (new_ctx);return 0 ;
@@ -641,6 +584,82 @@ out_abort:return XFS_ERROR (EIO ); } +static void +xlog_cil_push_work ( +struct work_struct *work) +{ + struct xfs_cil *cil = container_of(work, struct xfs_cil, + xc_push_work); +xlog_cil_push (cil->xc_log); +} + +/* +* We need to push CIL every so often so we don't cache more than we can fit in +* the log. The limit really is that a checkpoint can't be more than half the +* log (the current checkpoint is not allowed to overwrite the previous +* checkpoint), but commit latency and memory usage limit this to a smaller +* size. +*/ +static void +xlog_cil_push_background ( +struct log *log) +{ +struct xfs_cil *cil = log->l_cilp; + +/* +* The cil won't be empty because we are called while holding the +* context lock so whatever we added to the CIL will still be there +*/ +ASSERT (!list_empty (&cil->xc_cil)); + +/* +* don't do a background push if we haven't used up all the +* space available yet. +*/ +if (cil->xc_ctx->space_used <XLOG_CIL_SPACE_LIMIT (log)) +return ; + +spin_lock (&cil->xc_cil_lock); +if (cil->xc_push_seq < cil->xc_current_sequence) { + cil->xc_push_seq = cil->xc_current_sequence; +queue_work (log->l_mp->m_cil_workqueue, &cil->xc_push_work); + } +spin_unlock (&cil->xc_cil_lock); + +} + +static void +xlog_cil_push_foreground ( +struct log *log, +xfs_lsn_t push_seq) +{ +struct xfs_cil *cil = log->l_cilp; + +if (!cil) +return ; + +ASSERT (push_seq && push_seq <= cil->xc_current_sequence); + +/* start on any pending background push to minimise wait time on it */ +flush_work (&cil->xc_push_work); + +/* +* If the CIL is empty or we've already pushed the sequence then +* there's no work we need to do. +*/ +spin_lock (&cil->xc_cil_lock); +if (list_empty (&cil->xc_cil) || push_seq <= cil->xc_push_seq) { +spin_unlock (&cil->xc_cil_lock); +return ; + } + + cil->xc_push_seq = push_seq; +spin_unlock (&cil->xc_cil_lock); + +/* do the push now */ +xlog_cil_push (log); +} +/* * Commit a transaction with the given vector to the Committed Item List. *
@@ -667,7 +686,6 @@ xfs_log_commit_cil( {struct log *log = mp->m_log;int log_flags =0 ; -int push =0 ;struct xfs_log_vec *log_vector;if (flags &XFS_TRANS_RELEASE_LOG_RES )
@@ -719,21 +737,9 @@ xfs_log_commit_cil(*/ xfs_trans_free_items (tp, *commit_lsn,0 ); -/* check for background commit before unlock */ -if (log->l_cilp->xc_ctx->space_used >XLOG_CIL_SPACE_LIMIT (log)) - push =1 ; +xlog_cil_push_background (log);up_read (&log->l_cilp->xc_ctx_lock); - -/* -* We need to push CIL every so often so we don't cache more than we -* can fit in the log. The limit really is that a checkpoint can't be -* more than half the log (the current checkpoint is not allowed to -* overwrite the previous checkpoint), but commit latency and memory -* usage limit this to a smaller size in most cases. -*/ -if (push) -xlog_cil_push (log,0 );return 0 ; }
@@ -746,9 +752,6 @@ xfs_log_commit_cil(* * We return the current commit lsn to allow the callers to determine if a * iclog flush is necessary following this call. -* -* XXX: Initially, just push the CIL unconditionally and return whatever -* commit lsn is there. It'll be empty, so this is broken for now. */ xfs_lsn_t xlog_cil_force_lsn(
@@ -766,8 +769,7 @@ xlog_cil_force_lsn(* xlog_cil_push() handles racing pushes for the same sequence, * so no need to deal with it here. */ -if (sequence == cil->xc_current_sequence) -xlog_cil_push (log, sequence); +xlog_cil_push_foreground (log, sequence);/* * See if we can find a previous sequence still committing.
@@ -826,3 +828,57 @@ xfs_log_item_in_current_chkpt(return false;return true; } + +/* +* Perform initial CIL structure initialisation. +*/ +int +xlog_cil_init ( +struct log *log) +{ +struct xfs_cil *cil; +struct xfs_cil_ctx *ctx; + + cil =kmem_zalloc (sizeof (*cil),KM_SLEEP |KM_MAYFAIL ); +if (!cil) +return ENOMEM ; + + ctx =kmem_zalloc (sizeof (*ctx),KM_SLEEP |KM_MAYFAIL ); +if (!ctx) { +kmem_free (cil); +return ENOMEM ; + } + +INIT_WORK (&cil->xc_push_work, xlog_cil_push_work); +INIT_LIST_HEAD (&cil->xc_cil); +INIT_LIST_HEAD (&cil->xc_committing); +spin_lock_init (&cil->xc_cil_lock); +init_rwsem (&cil->xc_ctx_lock); +init_waitqueue_head (&cil->xc_commit_wait); + +INIT_LIST_HEAD (&ctx->committing); +INIT_LIST_HEAD (&ctx->busy_extents); + ctx->sequence =1 ; + ctx->cil = cil; + cil->xc_ctx = ctx; + cil->xc_current_sequence = ctx->sequence; + + cil->xc_log = log; + log->l_cilp = cil; +return 0 ; +} + +void +xlog_cil_destroy ( +struct log *log) +{ +if (log->l_cilp->xc_ctx) { +if (log->l_cilp->xc_ctx->ticket) +xfs_log_ticket_put (log->l_cilp->xc_ctx->ticket); +kmem_free (log->l_cilp->xc_ctx); + } + +ASSERT (list_empty (&log->l_cilp->xc_cil)); +kmem_free (log->l_cilp); +} +
fs/xfs/xfs_log_priv.h +2 -0
@@ -417,6 +417,8 @@ struct xfs_cil {struct list_head xc_committing;wait_queue_head_t xc_commit_wait;xfs_lsn_t xc_current_sequence; +struct work_struct xc_push_work; +xfs_lsn_t xc_push_seq; };/*
fs/xfs/xfs_mount.h +1 -0
@@ -214,6 +214,7 @@ typedef struct xfs_mount {struct workqueue_struct *m_data_workqueue;struct workqueue_struct *m_unwritten_workqueue; +struct workqueue_struct *m_cil_workqueue; } xfs_mount_t;/*
fs/xfs/xfs_super.c +7 -0
@@ -773,8 +773,14 @@ xfs_init_mount_workqueues(if (!mp->m_unwritten_workqueue) goto out_destroy_data_iodone_queue; + mp->m_cil_workqueue =alloc_workqueue ("xfs-cil/%s" , +WQ_MEM_RECLAIM ,0 , mp->m_fsname); +if (!mp->m_cil_workqueue) + goto out_destroy_unwritten;return 0 ; +out_destroy_unwritten: +destroy_workqueue (mp->m_unwritten_workqueue); out_destroy_data_iodone_queue:destroy_workqueue (mp->m_data_workqueue); out:
@@ -785,6 +791,7 @@ STATIC voidxfs_destroy_mount_workqueues ( struct xfs_mount *mp) { +destroy_workqueue (mp->m_cil_workqueue);destroy_workqueue (mp->m_data_workqueue);destroy_workqueue (mp->m_unwritten_workqueue); }
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 02/37] xfs: remove log item from AIL in xfs_iflush after a shutdown
In reply to Dave ChinnerQuoted 9 lines · Dave Chinner
From: Christoph Hellwig<[email protected]>
If a filesystem has been forced shutdown we are never going to write inodes to disk, which means the inode items will stay in the AIL until we free the inode. Currently that is not a problem, but a pending change requires us to empty the AIL before shutting down the filesystem. In that case leaving the inode in the AIL is lethal. Make sure to remove the log item from the AIL to allow emptying the AIL on shutdown filesystems.
Quoted 3 lines
Signed-off-by Christoph Hellwig<[email protected]>Reviewed-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 04/37] xfs: implement freezing by emptying the AIL
In reply to Dave ChinnerQuoted 26 lines · Dave Chinner
From: Christoph Hellwig<[email protected]>
Now that we write back all metadata either synchronously or through the AIL we can simply implement metadata freezing in terms of emptying the AIL.
The implementation for this is fairly simply and straight-forward:
A new routine is added that asks the xfsaild to push the AIL to the end and waits for it to complete and send a wakeup. The routine will then loop if the AIL is not actually empty, and continue to do so until the AIL is compeltely empty.We keep an inode reclaim pass in the freeze process to avoid having memory pressure have to reclaim inodes that require dirtying the filesystem to be reclaimed after the freeze has completed. This means we can also treat unmount in the exact same way as freeze.
As an upside we can now remove the radix tree based inode writeback and
xfs_unmountfs_writesb.[ Dave Chinner:
- Cleaned up commit message.
- Added inode reclaim passes back into freeze.
- Cleaned up wakeup mechanism to avoid the use of a new sleep counter variable. ]
Quoted 3 lines
Signed-off-by Christoph Hellwig<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 10/37] xfs: remove some obsolete comments in xfs_trans_ail.c
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Christoph Hellwig<[email protected]>
Signed-off-by Christoph Hellwig<[email protected]>Reviewed-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 28/37] xfs: move xfsagino_t to xfs_types.h
In reply to Dave ChinnerQuoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Untangle the header file includes a bit by moving the definition of
xfs_agino_ttoxfs_types.h. This removes the dependency thatxfs_ag.hhas onxfs_inum.h, meaning we don't need to includexfs_inum.heverywhere we includexfs_ag.h.Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 36/37] xfs: flush outstanding buffers on log mount failure
In reply to Dave ChinnerQuoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
When we fail to mount the log in
xfs_mountfs(), we tear down all the infrastructure we have already allocated. However, the process of mounting the log may have progressed to the point of reading, caching and modifying buffers in memory. Hence before we can free all the infrastructure, we have to flush and remove all the buffers from memory.
Quoted 5 lines
Problem first reported by Eric Sandeen, later a different incarnation was reported by Ben Myers.
Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 29/37] xfs: move busy extent handling to it's own file
In reply to Dave ChinnerHey Dave,
Quoted 8 lines · Dave Chinner
From: Dave Chinner <[email protected]>
To make it easier to handle userspace code merges, move all the busy extent handling out of the allocation code and into it's own file. The userspace code does not need the busy extent code, so this simplifies the merging of the kernel code into the userspace xfsprogs library.
Quoted 5 lines
Because the busy extent code has been almost completely rewritten over the past couple of years, also update the copyright on this new file to include the authors that made all those changes.
Signed-off-by Dave Chinner <[email protected]>
D'oh! This one doesn't compile:
/root/xfs/fs/xfs/xfs_discard.c:32:29: fatal error: xfs_extent_busy.h: No such file or directory
-Ben
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Hi Dave,
Quoted 7 lines · Dave Chinner
I haven't been able to reproduce Ben's CIL commit sequence assert failure from the async log flushing patch (patch 12/37), so whatever the cause of that problem is is still unknown.
[ Actually, as I wrote this I had a concurrent rm -rf just trip this assert, so the problem is real and I've obviously got more work to do on this one.... ]
I just hit it again, looks like in test 273.
[ 6587.548841] XFS: Assertion failed: push_seq > 0 && push_seq <= ctx->sequence, file: /root/xfs/fs/xfs/xfs_log_cil.c, line: 405
This time I have a dump. ;)
-Ben
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 7 lines · Ben Myers
Hi Dave,
Quoted 4 lines · Dave Chinner
I haven't been able to reproduce Ben's CIL commit sequence assert failure from the async log flushing patch (patch 12/37), so whatever the cause of that problem is is still unknown.
Quoted 8 lines
Quoted 3 lines
[ Actually, as I wrote this I had a concurrent rm -rf just trip this assert, so the problem is real and I've obviously got more work to do on this one.... ]
I just hit it again, looks like in test 273.
[ 6587.548841] XFS: Assertion failed: push_seq > 0 && push_seq <= ctx->sequence, file: /root/xfs/fs/xfs/xfs_log_cil.c, line: 405This time I have a dump. ;)
Try version 2 of the patch (#12)....
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH v2 29/37 xfs: move busy extent handling to it's own file
In reply to Ben MyersQuoted 15 lines · Ben Myers
Hey Dave,
Quoted 12 lines · Dave Chinner
From: Dave Chinner <[email protected]>
To make it easier to handle userspace code merges, move all the busy extent handling out of the allocation code and into it's own file. The userspace code does not need the busy extent code, so this simplifies the merging of the kernel code into the userspace xfsprogs library.
Because the busy extent code has been almost completely rewritten over the past couple of years, also update the copyright on this new file to include the authors that made all those changes.
Quoted 5 lines
Quoted 1 line
Signed-off-by Dave Chinner <[email protected]>D'oh! This one doesn't compile:
/root/xfs/fs/xfs/xfs_discard.c:32:29: fatal error:xfs_extent_busy.h: No such file or directory
Ah, the file got lost from the patch when rebasing. It was still sitting in my tree. Updated patch below.
Cheers,
Dave.
Signature · 30 lines
Dave Chinner [email protected] xfs: move busy extent handling to it's own file From: Dave Chinner <[email protected]> To make it easier to handle userspace code merges, move all the busy extent handling out of the allocation code and into it's own file. The userspace code does not need the busy extent code, so this simplifies the merging of the kernel code into the userspace xfsprogs library. Because the busy extent code has been almost completely rewritten over the past couple of years, also update the copyright on this new file to include the authors that made all those changes. Signed-off-by: Dave Chinner <[email protected]> --- fs/xfs/Makefile | 1 + fs/xfs/xfs_ag.h | 18 -- fs/xfs/xfs_alloc.c | 572 +------------------------------------------ fs/xfs/xfs_alloc.h | 28 --- fs/xfs/xfs_alloc_btree.c | 1 + fs/xfs/xfs_discard.c | 1 + fs/xfs/xfs_extent_busy.c | 603 ++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_extent_busy.h | 65 +++++ fs/xfs/xfs_log_cil.c | 1 + fs/xfs/xfs_trans.c | 1 + 10 files changed, 674 insertions(+), 617 deletions(-)
fs/xfs/Makefile +1 -0
@@ -33,6 +33,7 @@ xfs-y += xfs_aops.o \ xfs_discard.o \ xfs_error.o \ xfs_export.o \ + xfs_extent_busy.o \ xfs_file.o \ xfs_filestream.o \ xfs_fsops.o \
fs/xfs/xfs_ag.h +0 -18
@@ -175,24 +175,6 @@ typedef struct xfs_agfl { } xfs_agfl_t;/* -* Busy block/extent entry. Indexed by a rbtree in perag to mark blocks that -* have been freed but whose transactions aren't committed to disk yet. -* -* Note that we use the transaction ID to record the transaction, not the -* transaction structure itself. See xfs_alloc_busy_insert() for details. -*/ -struct xfs_busy_extent { -struct rb_node rb_node;/* ag by-bno indexed search tree */ -struct list_head list;/* transaction busy extent list */ -xfs_agnumber_t agno; -xfs_agblock_t bno; -xfs_extlen_t length; -unsigned int flags; -#define XFS_ALLOC_BUSY_DISCARDED 0x01/* undergoing a discard op. */ -#define XFS_ALLOC_BUSY_SKIP_DISCARD 0x02/* do not discard */ -}; - -/* * Per-ag incore structure, copies of information in agf and agi, * to improve the performance of allocation group selection. */
fs/xfs/xfs_alloc.c +1 -571
581 lines not on this page · raw message
fs/xfs/xfs_alloc.h +0 -28
@@ -23,7 +23,6 @@ struct xfs_btree_cur;struct xfs_mount ;struct xfs_perag ;struct xfs_trans ; -struct xfs_busy_extent ;extern struct workqueue_struct *xfs_alloc_wq;
@@ -139,33 +138,6 @@ xfs_extlen_t xfs_alloc_longest_free_extent(struct xfs_mount *mp, struct xfs_perag *pag); -#ifdef __KERNEL__ -void -xfs_alloc_busy_insert (struct xfs_trans *tp,xfs_agnumber_t agno, -xfs_agblock_t bno,xfs_extlen_t len,unsigned int flags); - -void -xfs_alloc_busy_clear (struct xfs_mount *mp,struct list_head *list, -bool do_discard); - -int -xfs_alloc_busy_search (struct xfs_mount *mp,xfs_agnumber_t agno, -xfs_agblock_t bno,xfs_extlen_t len); - -void -xfs_alloc_busy_reuse (struct xfs_mount *mp,xfs_agnumber_t agno, -xfs_agblock_t fbno,xfs_extlen_t flen,bool userdata); - -int -xfs_busy_extent_ag_cmp (void *priv,struct list_head *a,struct list_head *b); - -static inline void xfs_alloc_busy_sort (struct list_head *list) -{ -list_sort (NULL , list, xfs_busy_extent_ag_cmp); -} - -#endif /* __KERNEL__ */ -/* * Compute and fill in value of m_ag_maxlevels. */
fs/xfs/xfs_alloc_btree.c +1 -0
@@ -31,6 +31,7 @@#include "xfs_inode.h" #include "xfs_btree.h" #include "xfs_alloc.h" +#include "xfs_extent_busy.h" #include "xfs_error.h" #include "xfs_trace.h"
fs/xfs/xfs_discard.c +1 -0
@@ -29,6 +29,7 @@#include "xfs_inode.h" #include "xfs_alloc.h" #include "xfs_error.h" +#include "xfs_extent_busy.h" #include "xfs_discard.h" #include "xfs_trace.h"
fs/xfs/xfs_extent_busy.c new file +603 -0
603 lines not on this page · raw message
fs/xfs/xfs_extent_busy.h new file +65 -0
65 lines not on this page · raw message
fs/xfs/xfs_log_cil.c +1 -0
@@ -28,6 +28,7 @@#include "xfs_mount.h" #include "xfs_error.h" #include "xfs_alloc.h" +#include "xfs_extent_busy.h" #include "xfs_discard.h" /*
fs/xfs/xfs_trans.c +1 -0
@@ -35,6 +35,7 @@#include "xfs_btree.h" #include "xfs_ialloc.h" #include "xfs_alloc.h" +#include "xfs_extent_busy.h" #include "xfs_bmap.h" #include "xfs_quota.h" #include "xfs_trans_priv.h"
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 28/37] xfs: move xfsagino_t to xfs_types.h
In reply to Dave ChinnerQuoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Untangle the header file includes a bit by moving the definition of
xfs_agino_ttoxfs_types.h. This removes the dependency thatxfs_ag.hhas onxfs_inum.h, meaning we don't need to includexfs_inum.heverywhere we includexfs_ag.h.Signed-off-by Dave Chinner<[email protected]>---
Looks good
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 29/37 V2] xfs: move busy extent handling to it's own file
In reply to Dave ChinnerOn 04/23/12 19:25, Dave Chinner wrote:
From: Dave Chinner <[email protected]>
To make it easier to handle userspace code merges, move all the busy extent handling out of the allocation code and into it's own file. The userspace code does not need the busy extent code, so this simplifies the merging of the kernel code into the userspace xfsprogs library.
Because the busy extent code has been almost completely rewritten over the past couple of years, also update the copyright on this new file to include the authors that made all those changes.
---
Should xfs_alloc_busy_trim() be STATIC? It is defined in xfs_extent_busy.c and used in xfs_alloc.c.
Same story for the next patch which renames this routine.
Thanks,
Mark Tinguely <[email protected]>
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Mark Tinguely
Reviewed-byRe: [PATCH 29/37 V2] xfs: move busy extent handling to it's own file
Quoted 17 lines · Mark Tinguely
On 04/23/12 19:25, Dave Chinner wrote:
From: Dave Chinner <[email protected]>
To make it easier to handle userspace code merges, move all the busy extent handling out of the allocation code and into it's own file. The userspace code does not need the busy extent code, so this simplifies the merging of the kernel code into the userspace xfsprogs library.
Because the busy extent code has been almost completely rewritten over the past couple of years, also update the copyright on this new file to include the authors that made all those changes.
Signed-off-by Dave Chinner <[email protected]>---
Quoted 8 lines
Should
xfs_alloc_busy_trim()be STATIC? It is defined inxfs_extent_busy.cand used inxfs_alloc.c.Same story for the next patch which renames this routine.
Thanks,
Mark Tinguely <[email protected]>
FYI,
The routines in this patch call for struct xfs_busy_extent, but the xfs_extent_busy.h header file defines struct xfs_extent_busy.
I know this structure will get converted for the next patch.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 30/37] xfs: clean up busy extent naming
In reply to Dave ChinnerQuoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Now that the busy extent tracking has been moved out of the allocation files, clean up the namespace it uses to "
xfs_extent_busy" rather than a mix of "xfs_busy" and "xfs_alloc_busy".Signed-off-by Dave Chinner<[email protected]>---
Other than the STATIC on xfs_extend_busy_trim() leaving an undefined routine in the xfs.ko, it looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 31/37] xfs: move xfs_fsb_to_db to xfs_bmap.h
In reply to Dave ChinnerQuoted 7 lines · Dave Chinner
From: Dave Chinner<[email protected]>
This is the only remaining useful function in
xfs_rw.h, so move it to a header file responsible for block mapping functions that the callers already include. Soon we can get rid ofxfs_rw.h.Signed-off-by Dave Chinner<[email protected]>
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 32/37] xfs: move xfs_get_extsz_hint() and kill xfs_rw.h
In reply to Dave ChinnerQuoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The only thing left in
xfs_rw.his a function prototype for an inode function. Move that toxfs_inode.h, and killxfs_rw.h.Also move the function implementing the prototype from
xfs_rw.ctoxfs_inode.cso we only have one function left inxfs_rw.cSigned-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 33/37] xfs: move xfs_do_force_shutdown() and kill xfs_rw.c
In reply to Dave ChinnerQuoted 7 lines · Dave Chinner
From: Dave Chinner<[email protected]>
xfs-do-force_shutdown now is the only thing in
xfs_rw.c. There is no need to keep it in it's own file anymore, so move it toxfs_fsops.cnext toxfs_fs_goingdown()and killxfs_rw.c.Reviewed-by Dave Chinner<[email protected]>
Quoted 1 line
---
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 34/37] xfs: clean up xfs_bit.h includes
In reply to Dave ChinnerQuoted 11 lines · Dave Chinner
From: Dave Chinner<[email protected]>
With the removal of
xfs_rw.hand other changes over time,xfs_bit.his being included in many files that don't actually need it. Clean up the includes as necessary.Also move the only-used-once
xfs_ialloc_find_free()static inline function out of a header file that is widely included to reduce the number of needless dependencies onxfs_bit.h.Reviewed-by Dave Chinner<[email protected]>
Quoted 1 line
---
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 35/37] xfs: Properly exclude IO type flags from buffer flags
In reply to Dave ChinnerQuoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Recent event tracing during a debugging session showed that flags that define the IO type for a buffer are leaking into the flags on the buffer incorrectly. Fix the flag exclusion mask in
xfs_buf_alloc()to avoid problems that may be caused by such leakage.Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 09/37] xfs: on-stack delayed write buffer lists
In reply to Dave ChinnerQuoted 56 lines · Dave Chinner
From: Christoph Hellwig<[email protected]>
Queue delwri buffers on a local on-stack list instead of a per-buftarg one, and write back the buffers per-process instead of by waking up xfsbufd.
This is now easily doable given that we have very few places left that write delwri buffers:
- log recovery:
Only done at mount time, and already forcing out the buffers synchronously usingxfs_flush_buftarg- quotacheck:
Same story.- dquot reclaim:
Writes out dirty dquots on the LRU under memory pressure. We might want to look into doing more of this via xfsaild, but it's already more optimal than the synchronous inode reclaim that writes each buffer synchronously.- xfsaild:
This is the main beneficiary of the change. By keeping a local list of buffers to write we reduce latency of writing out buffers, and more importably we can remove all the delwri list promotions which were hitting the buffer cache hard under sustained metadata loads.The implementation is very straight forward -
xfs_buf_delwri_queuenow gets a newlist_headpointer that it adds the delwri buffers to, and all callers need to eventually submit the list usingxfs_buf_delwi_submitorxfs_buf_delwi_submit_nowait. Buffers that already are on a delwri list are skipped inxfs_buf_delwri_queue, assuming they already are on another delwri list. The biggest change to pass down the buffer list was done to the AIL pushing. Now that we operate on buffers the trylock, push and pushbuf log item methods are merged into a single push routine, which tries to lock the item, and if possible add the buffer that needs writeback to the buffer list. This leads to much simpler code than the previous split but requires the individualIOP_PUSHinstances to unlock and reacquire the AIL around calls to blocking routines.Given that xfsailds now also handle writing out buffers, the conditions for log forcing and the sleep times needed some small changes. The most important one is that we consider an AIL busy as long we still have buffers to push, and the other one is that we do increment the pushed LSN for buffers that are under flushing at this moment, but still count them towards the stuck items for restart purposes. Without this we could hammer on stuck items without ever forcing the log and not make progress under heavy random delete workloads on fast flash storage devices.
[ Dave Chinner:
- rebase on previous patches.
- improved comments forXBF_DELWRI_Qhandling
- fixXBF_ASYNChandling in queue submission (test 106 failure)
- rename delwri submit function buffer list parameters for clarity
-xfs_efd_item_push()should returnXFS_ITEM_PINNED]
Quoted 3 lines
Signed-off-by Christoph Hellwig<[email protected]>Reviewed-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 37/37] xfs: make XBF_MAPPED the default behaviour
In reply to Dave ChinnerQuoted 6 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Rather than specifying
XBF_MAPPEDfor almost all buffers, introduceXBF_UNMAPPEDfor the couple of users that use unmapped buffers.Signed-off-by Dave Chinner<[email protected]>
Quoted 10 lines
--- fs/xfs/xfs_buf.c | 28 +++++++++++++--------------- fs/xfs/xfs_buf.h | 4 ++-- fs/xfs/xfs_fsops.c | 10 +++++----- fs/xfs/xfs_inode.c | 1 + fs/xfs/xfs_log_recover.c | 4 ++-- fs/xfs/xfs_trans_buf.c | 6 ------ fs/xfs/xfs_vnodeops.c | 3 +-- 7 files changed, 24 insertions(+), 32 deletions(-)
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 37/37] xfs: make XBF_MAPPED the default behaviour
In reply to Dave ChinnerPS.
Quoted 18 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Rather than specifying
XBF_MAPPEDfor almost all buffers, introduceXBF_UNMAPPEDfor the couple of users that use unmapped buffers.Signed-off-by Dave Chinner<[email protected]>--- fs/xfs/xfs_buf.c | 28 +++++++++++++--------------- fs/xfs/xfs_buf.h | 4 ++-- fs/xfs/xfs_fsops.c | 10 +++++----- fs/xfs/xfs_inode.c | 1 + fs/xfs/xfs_log_recover.c | 4 ++-- fs/xfs/xfs_trans_buf.c | 6 ------ fs/xfs/xfs_vnodeops.c | 3 +-- 7 files changed, 24 insertions(+), 32 deletions(-)
fs/xfs/xfs_buf.c xfs_buf_set_empty( · line 711
Quoted 6 lines
fs/xfs/xfs_buf.c +0
-1@@ -707,7 +707,6 @@ xfs_buf_set_empty( bp->b_length = numblks; bp->b_io_length = numblks; bp->b_bn =XFS_BUF_DADDR_NULL ; - bp->b_flags&= ~XBF_MAPPED ; }
I know that bp->baddr is set to NULL and denotes that this is not mapped, but why not set the XBF_UNMAPPED?
fs/xfs/xfs_buf.c xfs_buf_associate_memory( · line 763
Quoted 9 lines
fs/xfs/xfs_buf.c +0
-1static inline struct page *@@ -759,7 +758,6 @@ xfs_buf_associate_memory( bp->b_io_length =BTOBB (len); bp->b_length =BTOBB (buflen); - bp->b_flags |=XBF_MAPPED ;return 0 ; }
I think the answer is no, but can XBF_UNMAPPED be set and leaked here?
Thanks
--Mark Tinguely
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 37/37] xfs: make XBF_MAPPED the default behaviour
Quoted 18 lines · Mark Tinguely
PS.
Quoted 16 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Rather than specifying
XBF_MAPPEDfor almost all buffers, introduceXBF_UNMAPPEDfor the couple of users that use unmapped buffers.Signed-off-by Dave Chinner<[email protected]>--- fs/xfs/xfs_buf.c | 28 +++++++++++++--------------- fs/xfs/xfs_buf.h | 4 ++-- fs/xfs/xfs_fsops.c | 10 +++++----- fs/xfs/xfs_inode.c | 1 + fs/xfs/xfs_log_recover.c | 4 ++-- fs/xfs/xfs_trans_buf.c | 6 ------ fs/xfs/xfs_vnodeops.c | 3 +-- 7 files changed, 24 insertions(+), 32 deletions(-)
Quoted 11 lines
fs/xfs/xfs_buf.c xfs_buf_set_empty( · line 711
Quoted 8 lines
fs/xfs/xfs_buf.c +0
-1@@ -707,7 +707,6 @@ xfs_buf_set_empty( bp->b_length = numblks; bp->b_io_length = numblks; bp->b_bn =XFS_BUF_DADDR_NULL ; - bp->b_flags&= ~XBF_MAPPED ; }I know that
bp->baddris set to NULL and denotes that this is not mapped, but why not set theXBF_UNMAPPED?
Because mapped/unmapped is essentially meaningless for buffers that use associated memory. These buffers have external memory attached to them, so the buffer cache is not responsible for allocating or freeing the memory. Further, the memory being attached to the buffer is assumed to be contiguous - this interface does not work with unmapped memory buffers. Hence setting XBF_UNMAPPED would actually be the wrong thing to do.
Quoted 11 lines
fs/xfs/xfs_buf.c xfs_buf_associate_memory( · line 763
Quoted 9 lines
fs/xfs/xfs_buf.c +0
-1static inline struct page *@@ -759,7 +758,6 @@ xfs_buf_associate_memory( bp->b_io_length =BTOBB (len); bp->b_length =BTOBB (buflen); - bp->b_flags |=XBF_MAPPED ;return 0 ; }I think the answer is no, but can
XBF_UNMAPPEDbe set and leaked here?
No, because xfs_buf_associate_memory() is only ever called on buffers that are set up to be mapped in the first place.
FWIW, xfs_buf_associate_memory() is really considered deprecated. It is only called in 3 places - two are doing an offset read in log recovery (2 of 3 callers of the function that does it are handling log I osplit over the physical end of the log) and the third direct caller is for setting up the extra log buffer for a split log IO when it wraps around the end of the physical log. IOWs, this is interface only remains in the code to support one specific quirk of the log, and at some point either Christoph or I will get around to fixing that, too. Then we can completely drop this interface....
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Dave,
I want to pull this in and have been testing toward that end. With Jan's patches this seems to be working well. I've had to disable a couple asserts:
fs/xfs/xfs_bmap.c +2 -2
@@ -5620,8 +5620,8 @@ xfs_getbmap(XFS_FSB_TO_BB (mp, map[i].br_blockcount); out[cur_ext].bmv_unused1 =0 ; out[cur_ext].bmv_unused2 =0 ; -ASSERT (((iflags &BMV_IF_DELALLOC ) !=0 ) || - (map[i].br_startblock !=DELAYSTARTBLOCK )); +// ASSERT(((iflags & BMV_IF_DELALLOC) != 0) || +// (map[i].br_startblock != DELAYSTARTBLOCK)); if (map[i].br_startblock ==HOLESTARTBLOCK && whichfork ==XFS_ATTR_FORK ) {/* came to the end of attribute fork */
fs/xfs/xfs_super.c +1 -1
@@ -822,7 +822,7 @@ xfs_fs_destroy_inode(if (is_bad_inode (inode)) goto out_reclaim; -ASSERT (XFS_FORCED_SHUTDOWN (ip->i_mount) || ip->i_delayed_blks ==0 ); +// ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || ip->i_delayed_blks == 0); /* * We should never get here with one of the reclaim flags already set.
That first one has been hanging around for awhile. It isn't due to this patch set. The second I'm not so sure about. Looks like you're addressing these in a different thread.
I'm also testing this patch set them without Jan's work, since I'm not sure when it will be pulled in. Here's the latest:
case login: [ 2934.077472] BUG: unable to handle kernel paging request at ffffc900036a8010
[ 2934.078452] IP: [<ffffffffa009a790>] xlog_get_lowest_lsn+0x30/0x80 [xfs] [ 2934.078452] PGD 12b029067 PUD 12b02a067 PMD 378f5067 PTE 0 [ 2934.078452] Oops: 0000 [#1] SMP [ 2934.078452] CPU 1 [ 2934.078452] Modules linked in: xfs(O) exportfs e1000e [last unloaded: xfs] [ 2934.078452] [ 2934.078452] Pid: 9031, comm: kworker/1:15 Tainted: G O 3.4.0-rc2+ #3 SGI.COM AltixXE310/X7DGT-INF [ 2934.078452] RIP: 0010:[<ffffffffa009a790>] [<ffffffffa009a790>] xlog_get_lowest_lsn+0x30/0x80 [xfs] [ 2934.078452] RSP: 0018:ffff880078281d10 EFLAGS: 00010246 [ 2934.078452] RAX: ffffc900036a8000 RBX: ffff8800378c7e00 RCX: ffff8800378c7e00 [ 2934.078452] RDX: ffff8800378426c0 RSI: 0000000000000000 RDI: 0000000000000000 [ 2934.078452] RBP: ffff880078281d10 R08: ffff8800378c7d00 R09: 0000000000000000 [ 2934.078452] R10: 0000000000000400 R11: 0000000000000001 R12: ffff880037842600 [ 2934.078452] R13: ffff8800378c7e00 R14: 0000000000000000 R15: ffff88012fc99205 [ 2934.078452] FS: 0000000000000000(0000) GS:ffff88012fc80000(0000) knlGS:0000000000000000 [ 2934.078452] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 2934.078452] CR2: ffffc900036a8010 CR3: 0000000037870000 CR4: 00000000000007e0 [ 2934.078452] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2934.078452] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 2934.078452] Process kworker/1:15 (pid: 9031, threadinfo ffff880078280000, task ffff880098f7a490) [ 2934.078452] Stack: [ 2934.078452] ffff880078281d90 ffffffffa009b006 0000000300000000 ffff8800378c7e00 [ 2934.078452] ffff880037842600 ffff8800378c7d00 0000000000000286 0000000000000000 [ 2934.078452] 0000000100000000 ffff8800378426a8 ffff8800378426c0 ffff8800378c7e00 [ 2934.078452] Call Trace: [ 2934.078452] [<ffffffffa009b006>] xlog_state_do_callback+0xa6/0x390 [xfs] [ 2934.078452] [<ffffffffa009b3d7>] xlog_state_done_syncing+0xe7/0x110 [xfs] [ 2934.078452] [<ffffffffa009bbde>] xlog_iodone+0x7e/0x100 [xfs] [ 2934.078452] [<ffffffffa00372d1>] xfs_buf_iodone_work+0x21/0x50 [xfs] [ 2934.078452] [<ffffffff81051498>] process_one_work+0x158/0x440 [ 2934.078452] [<ffffffffa00372b0>] ? xfs_bioerror_relse+0x80/0x80 [xfs] [ 2934.078452] [<ffffffff8105428b>] worker_thread+0x17b/0x410 [ 2934.078452] [<ffffffff81054110>] ? manage_workers+0x200/0x200 [ 2934.078452] [<ffffffff81058bce>] kthread+0x9e/0xb0 [ 2934.078452] [<ffffffff816f8014>] kernel_thread_helper+0x4/0x10 [ 2934.078452] [<ffffffff81058b30>] ? kthread_freezable_should_stop+0x70/0x70 [ 2934.078452] [<ffffffff816f8010>] ? gs_change+0xb/0xb [ 2934.078452] Code: 00 00 00 31 ff 48 89 e5 4c 89 c1 eb 0f 66 0f 1f 44 00 00 48 8b 49 30 49 39 c8 74 40 0f b7 41 5c a8 41 75 ef 48 8b 81 c8 00 00 00 <48> 8b 70 10 48 0f ce 48 85 f6 74 05 48 85 ff 74 14 48 89 f2 48 [ 2934.078452] RIP [<ffffffffa009a790>] xlog_get_lowest_lsn+0x30/0x80 [xfs] [ 2934.078452] RSP <ffff880078281d10> [ 2934.078452] CR2: ffffc900036a8010 [ 2934.078452] ---[ end trace b65516a5387874db ]---
Looks like I've seen that one before this patch series:
http://oss.sgi.com/pipermail/xfs/2012-March/017909.html
Looking good. ;)
-Ben
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 2 lines · Ben Myers
I want to pull this in and have been testing toward that end. With Jan's patches this seems to be working well.
Another BUG without Jan's patches:
[ 1811.832319] BUG: unable to handle kernel NULL pointer dereference at 0000000000000038 [ 1811.833303] IP: [<ffffffff816ef359>] _raw_spin_lock+0x9/0x30 [ 1811.833303] PGD 128d0d067 PUD 128675067 PMD 0 [ 1811.833303] Oops: 0002 [#1] SMP [ 1811.833303] CPU 2 [ 1811.833303] Modules linked in: xfs(O) nfsd exportfs e1000e [ 1811.833303] [ 1811.833303] Pid: 12942, comm: kworker/2:15 Tainted: G O 3.4.0-rc2+ #3 SGI.COM AltixXE310/X7DGT-INF [ 1811.833303] RIP: 0010:[<ffffffff816ef359>] [<ffffffff816ef359>] _raw_spin_lock+0x9/0x30 [ 1811.833303] RSP: 0018:ffff880129235b40 EFLAGS: 00010286 [ 1811.833303] RAX: 0000000000000100 RBX: ffff880128685480 RCX: 0000000000000000 [ 1811.833303] RDX: 0000000f00004cb5 RSI: ffff880128685480 RDI: 0000000000000038 [ 1811.833303] RBP: ffff880129235b40 R08: ffff88012870ab00 R09: 0000000000000000 [ 1811.833303] R10: 0000000000000400 R11: 0000000000000001 R12: ffff88012870ad80 [ 1811.833303] R13: ffff880126e5c180 R14: ffff880126e5c1b0 R15: ffff880128f48780 [ 1811.833303] FS: 0000000000000000(0000) GS:ffff88012fd00000(0000) knlGS:0000000000000000 [ 1811.833303] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 1811.833303] CR2: 0000000000000038 CR3: 0000000128aa2000 CR4: 00000000000007e0 [ 1811.833303] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 1811.833303] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 1811.833303] Process kworker/2:15 (pid: 12942, threadinfo ffff880129234000, task ffff88012ab83a80) [ 1811.833303] Stack: [ 1811.833303] ffff880129235cd0 ffffffffa00b8531 0000000000000000 0000000000001000 [ 1811.833303] 0000000000000000 0000000f00004cb5 0000000000000000 0000000000000038 [ 1811.833303] 0000000000000001 0000000000000000 0000000000000000 0000000000000000 [ 1811.833303] Call Trace: [ 1811.833303] [<ffffffffa00b8531>] xfs_trans_committed_bulk+0x41/0x300 [xfs] [ 1811.833303] [<ffffffff81068c3e>] ? try_to_wake_up+0x1fe/0x280 [ 1811.833303] [<ffffffffa00be4f6>] xlog_cil_committed+0x36/0x130 [xfs] [ 1811.833303] [<ffffffffa00ba07d>] xlog_state_do_callback+0x16d/0x390 [xfs] [ 1811.833303] [<ffffffffa00ba387>] xlog_state_done_syncing+0xe7/0x110 [xfs] [ 1811.833303] [<ffffffffa00bab8e>] xlog_iodone+0x7e/0x100 [xfs] [ 1811.833303] [<ffffffffa00562d1>] xfs_buf_iodone_work+0x21/0x50 [xfs] [ 1811.833303] [<ffffffff81051498>] process_one_work+0x158/0x440 [ 1811.833303] [<ffffffffa00562b0>] ? xfs_bioerror_relse+0x80/0x80 [xfs] [ 1811.833303] [<ffffffff8105428b>] worker_thread+0x17b/0x410 [ 1811.833303] [<ffffffff81054110>] ? manage_workers+0x200/0x200 [ 1811.833303] [<ffffffff81058bce>] kthread+0x9e/0xb0 [ 1811.833303] [<ffffffff816f8014>] kernel_thread_helper+0x4/0x10 [ 1811.833303] [<ffffffff81058b30>] ? kthread_freezable_should_stop+0x70/0x70 [ 1811.833303] [<ffffffff816f8010>] ? gs_change+0xb/0xb [ 1811.833303] Code: 89 c8 f0 66 0f b1 37 66 39 c1 c9 0f 94 c0 0f b6 d0 89 d0 c3 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 55 b8 00 01 00 00 48 89 e5 <f0> 66 0f c1 07 89 c2 66 c1 ea 08 38 d0 74 11 0f 1f 84 00 00 00 [ 1811.833303] RIP [<ffffffff816ef359>] _raw_spin_lock+0x9/0x30 [ 1811.833303] RSP <ffff880129235b40> [ 1811.833303] CR2: 0000000000000038 [ 1812.682556] ---[ end trace b7ab7432175048af ]---
-Ben
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 32 lines · Ben Myers
Quoted 2 lines · Ben Myers
I want to pull this in and have been testing toward that end. With Jan's patches this seems to be working well.
Another BUG without Jan's patches:
[ 1811.832319] BUG: unable to handle kernel NULL pointer dereference at 0000000000000038 [ 1811.833303] IP: [<ffffffff816ef359>] _raw_spin_lock+0x9/0x30 [ 1811.833303] PGD 128d0d067 PUD 128675067 PMD 0 [ 1811.833303] Oops: 0002 [#1] SMP [ 1811.833303] CPU 2 [ 1811.833303] Modules linked in: xfs(O) nfsd exportfs e1000e [ 1811.833303] [ 1811.833303] Pid: 12942, comm: kworker/2:15 Tainted: G O 3.4.0-rc2+ #3 SGI.COM AltixXE310/X7DGT-INF [ 1811.833303] RIP: 0010:[<ffffffff816ef359>] [<ffffffff816ef359>] _raw_spin_lock+0x9/0x30 [ 1811.833303] RSP: 0018:ffff880129235b40 EFLAGS: 00010286 [ 1811.833303] RAX: 0000000000000100 RBX: ffff880128685480 RCX: 0000000000000000 [ 1811.833303] RDX: 0000000f00004cb5 RSI: ffff880128685480 RDI: 0000000000000038 [ 1811.833303] RBP: ffff880129235b40 R08: ffff88012870ab00 R09: 0000000000000000 [ 1811.833303] R10: 0000000000000400 R11: 0000000000000001 R12: ffff88012870ad80 [ 1811.833303] R13: ffff880126e5c180 R14: ffff880126e5c1b0 R15: ffff880128f48780 [ 1811.833303] FS: 0000000000000000(0000) GS:ffff88012fd00000(0000) knlGS:0000000000000000 [ 1811.833303] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 1811.833303] CR2: 0000000000000038 CR3: 0000000128aa2000 CR4: 00000000000007e0 [ 1811.833303] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 1811.833303] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 1811.833303] Process kworker/2:15 (pid: 12942, threadinfo ffff880129234000, task ffff88012ab83a80) [ 1811.833303] Stack: [ 1811.833303] ffff880129235cd0 ffffffffa00b8531 0000000000000000 0000000000001000 [ 1811.833303] 0000000000000000 0000000f00004cb5 0000000000000000 0000000000000038 [ 1811.833303] 0000000000000001 0000000000000000 0000000000000000 0000000000000000 [ 1811.833303] Call Trace:
Quoted 8 lines
[ 1811.833303] [<ffffffffa00b8531>] xfs_trans_committed_bulk+0x41/0x300 [xfs] [ 1811.833303] [<ffffffff81068c3e>] ? try_to_wake_up+0x1fe/0x280 [ 1811.833303] [<ffffffffa00be4f6>] xlog_cil_committed+0x36/0x130 [xfs] [ 1811.833303] [<ffffffffa00ba07d>] xlog_state_do_callback+0x16d/0x390 [xfs] [ 1811.833303] [<ffffffffa00ba387>] xlog_state_done_syncing+0xe7/0x110 [xfs] [ 1811.833303] [<ffffffffa00bab8e>] xlog_iodone+0x7e/0x100 [xfs] [ 1811.833303] [<ffffffffa00562d1>] xfs_buf_iodone_work+0x21/0x50 [xfs] [ 1811.833303] [<ffffffff81051498>] process_one_work+0x158/0x440
Look slike the same thing - a NULL ailp, which implies the callback occurred while the log is being torn down..
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 26 lines · Ben Myers
Dave,
I want to pull this in and have been testing toward that end. With Jan's patches this seems to be working well. I've had to disable a couple asserts:
Index:
xfs/fs/xfs/xfs_bmap.c
===================================================================fs/xfs/xfs_bmap.c +2
-2@@ -5620,8 +5620,8 @@ xfs_getbmap(XFS_FSB_TO_BB (mp, map[i].br_blockcount); out[cur_ext].bmv_unused1 =0 ; out[cur_ext].bmv_unused2 =0 ; -ASSERT (((iflags &BMV_IF_DELALLOC ) !=0 ) || - (map[i].br_startblock !=DELAYSTARTBLOCK )); +// ASSERT(((iflags & BMV_IF_DELALLOC) != 0) || +// (map[i].br_startblock != DELAYSTARTBLOCK)); if (map[i].br_startblock ==HOLESTARTBLOCK && whichfork ==XFS_ATTR_FORK ) {/* came to the end of attribute fork */ Index:
xfs/fs/xfs/xfs_super.c
===================================================================
fs/xfs/xfs_super.c xfs_fs_destroy_inode( · line 825
Quoted 5 lines
fs/xfs/xfs_super.c +1
-1@@ -822,7 +822,7 @@ xfs_fs_destroy_inode(if (is_bad_inode (inode)) goto out_reclaim; -ASSERT (XFS_FORCED_SHUTDOWN (ip->i_mount) || ip->i_delayed_blks ==0 ); +// ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || ip->i_delayed_blks == 0);
That's the two problems my latest patch series help reduce. I think they solve this second one, and I now understand the remaining case I'm tripping over the first one, and that is a case of modifying the assert to avoid failure.
FYI, that last case is due to specualtive delalloc beyond EOF, and when allocating the range during writeback being able to allocate part of what is beyond EOF but not all of it due to limited available free space sizes. Hence data flushes will never be able to convert that remaining delalloc range beyond EOF, and so getbmap will assert fail above on that.
Quoted 3 lines
That first one has been hanging around for awhile. It isn't due to this patch set. The second I'm not so sure about. Looks like you're addressing these in a different thread.
Same problem, different failure modes.
Quoted 11 lines
I'm also testing this patch set them without Jan's work, since I'm not sure when it will be pulled in. Here's the latest:
case login: [ 2934.077472] BUG: unable to handle kernel paging request at
ffffc900036a8010[ 2934.078452] IP: [<ffffffffa009a790>] xlog_get_lowest_lsn+0x30/0x80 [xfs] [ 2934.078452] PGD 12b029067 PUD 12b02a067 PMD 378f5067 PTE 0 [ 2934.078452] Oops: 0000 [#1] SMP [ 2934.078452] CPU 1 [ 2934.078452] Modules linked in: xfs(O) exportfs e1000e [last unloaded: xfs] [ 2934.078452] [ 2934.078452] Pid: 9031, comm: kworker/1:15 Tainted: G O 3.4.0-rc2+ #3 SGI.COM AltixXE310/X7DGT-INF
What out-of-tree module do you have loaded that tainted the kernel? The ethernet driver?
Quoted 1 line
[ 2934.078452] RIP: 0010:[<ffffffffa009a790>] [<ffffffffa009a790>] xlog_get_lowest_lsn+0x30/0x80 [xfs]
.....
Quoted 4 lines
[ 2934.078452] Call Trace: [ 2934.078452] [<ffffffffa009b006>] xlog_state_do_callback+0xa6/0x390 [xfs] [ 2934.078452] [<ffffffffa009b3d7>] xlog_state_done_syncing+0xe7/0x110 [xfs] [ 2934.078452] [<ffffffffa009bbde>] xlog_iodone+0x7e/0x100 [xfs]
Quoted 8 lines
[ 2934.078452] [<ffffffffa00372d1>] xfs_buf_iodone_work+0x21/0x50 [xfs] [ 2934.078452] [<ffffffff81051498>] process_one_work+0x158/0x440 [ 2934.078452] [<ffffffffa00372b0>] ? xfs_bioerror_relse+0x80/0x80 [xfs] [ 2934.078452] [<ffffffff8105428b>] worker_thread+0x17b/0x410 [ 2934.078452] [<ffffffff81054110>] ? manage_workers+0x200/0x200 [ 2934.078452] [<ffffffff81058bce>] kthread+0x9e/0xb0 [ 2934.078452] [<ffffffff816f8014>] kernel_thread_helper+0x4/0x10 [ 2934.078452] [<ffffffff81058b30>] ? kthread_freezable_should_stop+0x70/0x70
Only way this can happen is if the log has already been torn down before an IO completion for a log write occurs. Not sure how that can happen, but we do do some log io (write the unmount record) on unmount and then tear down the log without having first flsuhed the buftarg....
Quoted 2 lines
Looks like I've seen that one before this patch series:
http://oss.sgi.com/pipermail/xfs/2012-March/017909.html
Yeah, i don't think it is related.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH v3 29/37 xfs: move busy extent handling to it's own file
In reply to Mark TinguelyQuoted 15 lines · Mark Tinguely
Quoted 14 lines · Mark Tinguely
On 04/23/12 19:25, Dave Chinner wrote:
From: Dave Chinner <[email protected]>
To make it easier to handle userspace code merges, move all the busy extent handling out of the allocation code and into it's own file. The userspace code does not need the busy extent code, so this simplifies the merging of the kernel code into the userspace xfsprogs library.
Because the busy extent code has been almost completely rewritten over the past couple of years, also update the copyright on this new file to include the authors that made all those changes.
Quoted 7 lines
Quoted 7 lines
Signed-off-by Dave Chinner <[email protected]>---
Should
xfs_alloc_busy_trim()be STATIC? It is defined inxfs_extent_busy.cand used inxfs_alloc.c.Same story for the next patch which renames this routine.
Fixed in the second patch. It really doesn't matter that much apart from stack traces on CONFIG_XFS_DEBUG kernels. In a lot of cases STATIC gives much better stack traces because it prevents the compiler from automatically inlining static functions. This can be a real pain when debugging because I've seen the compiler inline a couple of thousand lines of code into a single function. For small functions it's not really a big problem, though.
Quoted 2 lines
The routines in this patch call for struct
xfs_busy_extent, but thexfs_extent_busy.hheader file defines structxfs_extent_busy.
Fixed in the patch below, and I'll post a new version on the next patch as well.
Cheers,
Dave.
Signature · 30 lines
Dave Chinner [email protected] xfs: move busy extent handling to it's own file From: Dave Chinner <[email protected]> To make it easier to handle userspace code merges, move all the busy extent handling out of the allocation code and into it's own file. The userspace code does not need the busy extent code, so this simplifies the merging of the kernel code into the userspace xfsprogs library. Because the busy extent code has been almost completely rewritten over the past couple of years, also update the copyright on this new file to include the authors that made all those changes. Signed-off-by: Dave Chinner <[email protected]> --- fs/xfs/Makefile | 1 + fs/xfs/xfs_ag.h | 18 -- fs/xfs/xfs_alloc.c | 572 +------------------------------------------ fs/xfs/xfs_alloc.h | 28 --- fs/xfs/xfs_alloc_btree.c | 1 + fs/xfs/xfs_discard.c | 1 + fs/xfs/xfs_extent_busy.c | 603 ++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_extent_busy.h | 65 +++++ fs/xfs/xfs_log_cil.c | 1 + fs/xfs/xfs_trans.c | 1 + 10 files changed, 674 insertions(+), 617 deletions(-)
fs/xfs/Makefile +1 -0
@@ -33,6 +33,7 @@ xfs-y += xfs_aops.o \ xfs_discard.o \ xfs_error.o \ xfs_export.o \ + xfs_extent_busy.o \ xfs_file.o \ xfs_filestream.o \ xfs_fsops.o \
fs/xfs/xfs_ag.h +0 -18
@@ -175,24 +175,6 @@ typedef struct xfs_agfl { } xfs_agfl_t;/* -* Busy block/extent entry. Indexed by a rbtree in perag to mark blocks that -* have been freed but whose transactions aren't committed to disk yet. -* -* Note that we use the transaction ID to record the transaction, not the -* transaction structure itself. See xfs_alloc_busy_insert() for details. -*/ -struct xfs_busy_extent { -struct rb_node rb_node;/* ag by-bno indexed search tree */ -struct list_head list;/* transaction busy extent list */ -xfs_agnumber_t agno; -xfs_agblock_t bno; -xfs_extlen_t length; -unsigned int flags; -#define XFS_ALLOC_BUSY_DISCARDED 0x01/* undergoing a discard op. */ -#define XFS_ALLOC_BUSY_SKIP_DISCARD 0x02/* do not discard */ -}; - -/* * Per-ag incore structure, copies of information in agf and agi, * to improve the performance of allocation group selection. */
fs/xfs/xfs_alloc.c +1 -571
581 lines not on this page · raw message
fs/xfs/xfs_alloc.h +0 -28
@@ -23,7 +23,6 @@ struct xfs_btree_cur;struct xfs_mount ;struct xfs_perag ;struct xfs_trans ; -struct xfs_busy_extent ;extern struct workqueue_struct *xfs_alloc_wq;
@@ -139,33 +138,6 @@ xfs_extlen_t xfs_alloc_longest_free_extent(struct xfs_mount *mp, struct xfs_perag *pag); -#ifdef __KERNEL__ -void -xfs_alloc_busy_insert (struct xfs_trans *tp,xfs_agnumber_t agno, -xfs_agblock_t bno,xfs_extlen_t len,unsigned int flags); - -void -xfs_alloc_busy_clear (struct xfs_mount *mp,struct list_head *list, -bool do_discard); - -int -xfs_alloc_busy_search (struct xfs_mount *mp,xfs_agnumber_t agno, -xfs_agblock_t bno,xfs_extlen_t len); - -void -xfs_alloc_busy_reuse (struct xfs_mount *mp,xfs_agnumber_t agno, -xfs_agblock_t fbno,xfs_extlen_t flen,bool userdata); - -int -xfs_busy_extent_ag_cmp (void *priv,struct list_head *a,struct list_head *b); - -static inline void xfs_alloc_busy_sort (struct list_head *list) -{ -list_sort (NULL , list, xfs_busy_extent_ag_cmp); -} - -#endif /* __KERNEL__ */ -/* * Compute and fill in value of m_ag_maxlevels. */
fs/xfs/xfs_alloc_btree.c +1 -0
@@ -31,6 +31,7 @@#include "xfs_inode.h" #include "xfs_btree.h" #include "xfs_alloc.h" +#include "xfs_extent_busy.h" #include "xfs_error.h" #include "xfs_trace.h"
fs/xfs/xfs_discard.c +1 -0
@@ -29,6 +29,7 @@#include "xfs_inode.h" #include "xfs_alloc.h" #include "xfs_error.h" +#include "xfs_extent_busy.h" #include "xfs_discard.h" #include "xfs_trace.h"
fs/xfs/xfs_extent_busy.c new file +603 -0
603 lines not on this page · raw message
fs/xfs/xfs_extent_busy.h new file +65 -0
65 lines not on this page · raw message
fs/xfs/xfs_log_cil.c +1 -0
@@ -28,6 +28,7 @@#include "xfs_mount.h" #include "xfs_error.h" #include "xfs_alloc.h" +#include "xfs_extent_busy.h" #include "xfs_discard.h" /*
fs/xfs/xfs_trans.c +1 -0
@@ -35,6 +35,7 @@#include "xfs_btree.h" #include "xfs_ialloc.h" #include "xfs_alloc.h" +#include "xfs_extent_busy.h" #include "xfs_bmap.h" #include "xfs_quota.h" #include "xfs_trans_priv.h"
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v2 30/37 xfs: clean up busy extent naming
In reply to Mark TinguelyQuoted 8 lines · Mark Tinguely
Quoted 7 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Now that the busy extent tracking has been moved out of the allocation files, clean up the namespace it uses to "
xfs_extent_busy" rather than a mix of "xfs_busy" and "xfs_alloc_busy".
Quoted 5 lines
Quoted 2 lines
Signed-off-by Dave Chinner<[email protected]>---
Other than the STATIC on
xfs_extend_busy_trim()leaving an undefined routine in the xfs.ko, it looks good.
New version rebased on modified previous patch below.
Signature · 23 lines
Dave Chinner [email protected] xfs: clean up busy extent naming From: Dave Chinner <[email protected]> Now that the busy extent tracking has been moved out of the allocation files, clean up the namespace it uses to "xfs_extent_busy" rather than a mix of "xfs_busy" and "xfs_alloc_busy". Signed-off-by: Dave Chinner <[email protected]> --- fs/xfs/xfs_alloc.c | 12 +++---- fs/xfs/xfs_alloc_btree.c | 6 ++-- fs/xfs/xfs_discard.c | 4 +-- fs/xfs/xfs_extent_busy.c | 78 +++++++++++++++++++++++----------------------- fs/xfs/xfs_extent_busy.h | 20 ++++++------ fs/xfs/xfs_log_cil.c | 6 ++-- fs/xfs/xfs_trace.h | 16 +++++----- fs/xfs/xfs_trans.c | 4 +-- 8 files changed, 73 insertions(+), 73 deletions(-)
fs/xfs/xfs_alloc.c +6 -6
@@ -47,7 +47,7 @@ STATIC int xfs_alloc_ag_vextent_near(xfs_alloc_arg_t *); STATIC int xfs_alloc_ag_vextent_size(xfs_alloc_arg_t *); STATIC int xfs_alloc_ag_vextent_small(xfs_alloc_arg_t *,xfs_btree_cur_t *,xfs_agblock_t *,xfs_extlen_t *,int *); -STATIC void xfs_alloc_busy_trim(struct xfs_alloc_arg *, +STATIC void xfs_extent_busy_trim(struct xfs_alloc_arg *,xfs_agblock_t ,xfs_extlen_t ,xfs_agblock_t *,xfs_extlen_t *);/*
@@ -152,7 +152,7 @@ xfs_alloc_compute_aligned(xfs_extlen_t len;/* Trim busy sections out of found extent */ -xfs_alloc_busy_trim (args, foundbno, foundlen, &bno, &len); +xfs_extent_busy_trim (args, foundbno, foundlen, &bno, &len);if (args->alignment >1 && len >= args->minlen) {xfs_agblock_t aligned_bno =roundup (bno, args->alignment);
@@ -536,7 +536,7 @@ xfs_alloc_ag_vextent(if (error)return error; -ASSERT (!xfs_alloc_busy_search (args->mp, args->agno, +ASSERT (!xfs_extent_busy_search (args->mp, args->agno, args->agbno, args->len)); }
@@ -603,7 +603,7 @@ xfs_alloc_ag_vextent_exact(/* * Check for overlapping busy extents. */ -xfs_alloc_busy_trim (args, fbno, flen, &tbno, &tlen); +xfs_extent_busy_trim (args, fbno, flen, &tbno, &tlen);/* * Give up if the start of the extent is busy, or the freespace isn't
@@ -1391,7 +1391,7 @@ xfs_alloc_ag_vextent_small(if (error) goto error0;if (fbno !=NULLAGBLOCK ) { -xfs_alloc_busy_reuse (args->mp, args->agno, fbno,1 , +xfs_extent_busy_reuse (args->mp, args->agno, fbno,1 , args->userdata);if (args->userdata) {
@@ -2496,7 +2496,7 @@ xfs_free_extent( error =xfs_free_ag_extent (tp, args.agbp, args.agno, args.agbno, len,0 );if (!error) -xfs_alloc_busy_insert (tp, args.agno, args.agbno, len,0 ); +xfs_extent_busy_insert (tp, args.agno, args.agbno, len,0 ); error0:xfs_perag_put (args.pag);return error;
fs/xfs/xfs_alloc_btree.c +3 -3
@@ -94,7 +94,7 @@ xfs_allocbt_alloc_block(return 0 ; } -xfs_alloc_busy_reuse (cur->bc_mp, cur->bc_private.a.agno, bno,1 , false); +xfs_extent_busy_reuse (cur->bc_mp, cur->bc_private.a.agno, bno,1 , false);xfs_trans_agbtree_delta (cur->bc_tp,1 ); new->s =cpu_to_be32 (bno);
@@ -119,8 +119,8 @@ xfs_allocbt_free_block(if (error)return error; -xfs_alloc_busy_insert (cur->bc_tp,be32_to_cpu (agf->agf_seqno), bno,1 , -XFS_ALLOC_BUSY_SKIP_DISCARD ); +xfs_extent_busy_insert (cur->bc_tp,be32_to_cpu (agf->agf_seqno), bno,1 , +XFS_EXTENT_BUSY_SKIP_DISCARD );xfs_trans_agbtree_delta (cur->bc_tp,-1 );return 0 ; }
fs/xfs/xfs_discard.c +2 -2
@@ -118,7 +118,7 @@ xfs_trim_extents(* If any blocks in the range are still busy, skip the * discard and try again the next time. */ -if (xfs_alloc_busy_search (mp, agno, fbno, flen)) { +if (xfs_extent_busy_search (mp, agno, fbno, flen)) {trace_xfs_discard_busy (mp, agno, fbno, flen); goto next_extent; }
@@ -212,7 +212,7 @@ xfs_discard_extents(struct xfs_mount *mp, struct list_head *list) { - struct xfs_busy_extent *busyp; + struct xfs_extent_busy *busyp;int error =0 ;list_for_each_entry (busyp, list, list) {
fs/xfs/xfs_extent_busy.c +39 -39
242 lines not on this page · raw message
fs/xfs/xfs_extent_busy.h +10 -10
@@ -27,39 +27,39 @@* Note that we use the transaction ID to record the transaction, not the * transaction structure itself. See xfs_extent_busy_insert() for details. */ -struct xfs_busy_extent { +struct xfs_extent_busy {struct rb_node rb_node;/* ag by-bno indexed search tree */ struct list_head list;/* transaction busy extent list */ xfs_agnumber_t agno;xfs_agblock_t bno;xfs_extlen_t length;unsigned int flags; -#define XFS_ALLOC_BUSY_DISCARDED 0x01/* undergoing a discard op. */ -#define XFS_ALLOC_BUSY_SKIP_DISCARD 0x02/* do not discard */ +#define XFS_EXTENT_BUSY_DISCARDED 0x01/* undergoing a discard op. */ +#define XFS_EXTENT_BUSY_SKIP_DISCARD 0x02/* do not discard */ };void -xfs_alloc_busy_insert (struct xfs_trans *tp,xfs_agnumber_t agno, +xfs_extent_busy_insert (struct xfs_trans *tp,xfs_agnumber_t agno,xfs_agblock_t bno,xfs_extlen_t len,unsigned int flags);void -xfs_alloc_busy_clear (struct xfs_mount *mp,struct list_head *list, +xfs_extent_busy_clear (struct xfs_mount *mp,struct list_head *list,bool do_discard);int -xfs_alloc_busy_search (struct xfs_mount *mp,xfs_agnumber_t agno, +xfs_extent_busy_search (struct xfs_mount *mp,xfs_agnumber_t agno,xfs_agblock_t bno,xfs_extlen_t len);void -xfs_alloc_busy_reuse (struct xfs_mount *mp,xfs_agnumber_t agno, +xfs_extent_busy_reuse (struct xfs_mount *mp,xfs_agnumber_t agno,xfs_agblock_t fbno,xfs_extlen_t flen,bool userdata);int -xfs_alloc_busy_ag_cmp (void *priv,struct list_head *a,struct list_head *b); +xfs_extent_busy_ag_cmp (void *priv,struct list_head *a,struct list_head *b); -static inline void xfs_alloc_busy_sort (struct list_head *list) +static inline void xfs_extent_busy_sort (struct list_head *list) { -list_sort (NULL , list, xfs_alloc_busy_ag_cmp); +list_sort (NULL , list, xfs_extent_busy_ag_cmp); }#endif /* __XFS_EXTENT_BUSY_H__ */
fs/xfs/xfs_log_cil.c +3 -3
@@ -338,8 +338,8 @@ xlog_cil_committed(xfs_trans_committed_bulk (ctx->cil->xc_log->l_ailp, ctx->lv_chain, ctx->start_lsn, abort); -xfs_alloc_busy_sort (&ctx->busy_extents); -xfs_alloc_busy_clear (mp, &ctx->busy_extents, +xfs_extent_busy_sort (&ctx->busy_extents); +xfs_extent_busy_clear (mp, &ctx->busy_extents, (mp->m_flags &XFS_MOUNT_DISCARD ) && !abort);spin_lock (&ctx->cil->xc_cil_lock);
@@ -352,7 +352,7 @@ xlog_cil_committed(ASSERT (mp->m_flags &XFS_MOUNT_DISCARD );xfs_discard_extents (mp, &ctx->busy_extents); -xfs_alloc_busy_clear (mp, &ctx->busy_extents, false); +xfs_extent_busy_clear (mp, &ctx->busy_extents, false); }kmem_free (ctx);
fs/xfs/xfs_trace.h +8 -8
@@ -1142,7 +1142,7 @@ TRACE_EVENT(xfs_bunmap, ); -DECLARE_EVENT_CLASS(xfs_busy_class, +DECLARE_EVENT_CLASS(xfs_extent_busy_class, TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno, xfs_extlen_t len), TP_ARGS(mp, agno, agbno, len),
@@ -1165,17 +1165,17 @@ DECLARE_EVENT_CLASS(xfs_busy_class, __entry->len) );#define DEFINE_BUSY_EVENT (name) \ -DEFINE_EVENT(xfs_busy_class, name, \ +DEFINE_EVENT(xfs_extent_busy_class, name, \ TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ xfs_agblock_t agbno, xfs_extlen_t len), \ TP_ARGS(mp, agno, agbno, len)) -DEFINE_BUSY_EVENT (xfs_alloc_busy); -DEFINE_BUSY_EVENT (xfs_alloc_busy_enomem); -DEFINE_BUSY_EVENT (xfs_alloc_busy_force); -DEFINE_BUSY_EVENT (xfs_alloc_busy_reuse); -DEFINE_BUSY_EVENT (xfs_alloc_busy_clear); +DEFINE_BUSY_EVENT (xfs_extent_busy); +DEFINE_BUSY_EVENT (xfs_extent_busy_enomem); +DEFINE_BUSY_EVENT (xfs_extent_busy_force); +DEFINE_BUSY_EVENT (xfs_extent_busy_reuse); +DEFINE_BUSY_EVENT (xfs_extent_busy_clear); -TRACE_EVENT(xfs_alloc_busy_trim, +TRACE_EVENT(xfs_extent_busy_trim, TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno, xfs_extlen_t len, xfs_agblock_t tbno, xfs_extlen_t tlen),
fs/xfs/xfs_trans.c +2 -2
@@ -613,8 +613,8 @@ STATIC voidxfs_trans_free ( struct xfs_trans *tp) { -xfs_alloc_busy_sort (&tp->t_busy); -xfs_alloc_busy_clear (tp->t_mountp, &tp->t_busy, false); +xfs_extent_busy_sort (&tp->t_busy); +xfs_extent_busy_clear (tp->t_mountp, &tp->t_busy, false);atomic_dec (&tp->t_mountp->m_active_trans);if (tp->t_flags &XFS_TRANS_FREEZE_PROT )
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 04/37] xfs: implement freezing by emptying the AIL
In reply to Dave ChinnerThe updates look good to me, thanks.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 09/37] xfs: on-stack delayed write buffer lists
In reply to Dave ChinnerThe updates look fine to, thanks a lot for taking care of this while I was busy.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 12/37 V2] xfs: Do background CIL flushes via a workqueue
In reply to Dave ChinnerLooks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 14/37] xfs: Use preallocation for inodes with extsz hints
In reply to Dave ChinnerLooks reasonable,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 28/37] xfs: move xfsagino_t to xfs_types.h
In reply to Dave ChinnerQuoted 6 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Untangle the header file includes a bit by moving the definition of
xfs_agino_ttoxfs_types.h. This removes the dependency thatxfs_ag.hhas onxfs_inum.h, meaning we don't need to includexfs_inum.heverywhere we includexfs_ag.h.
This patch by itself looks good to me, but is there any good reason to keep xfs_inum.h around at all?
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 29/37 V3] xfs: move busy extent handling to it's own file
In reply to Dave ChinnerI would have called it xfs_busy_extent.h, but given how far you are with the series it's really not worth bike sheeding about this detail.
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 30/37 V2] xfs: clean up busy extent naming
In reply to Dave ChinnerSame naming comment as for the last one, but:
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 31/37] xfs: move xfs_fsb_to_db to xfs_bmap.h
In reply to Dave ChinnerQuoted 3 lines · Dave Chinner
From: Dave Chinner <[email protected]>
This is the only remaining useful function in
xfs_rw.h, so move it
Well, xfs_get_extsz_hint also still is useful, and you only move it in the next patch.
Quoted 5 lines
+/*
+ * Convert the given file system block to a disk block. We have to treat it
+ * differently based on whether the file is a real time file or not, because the
+ * bmap code does.
+ */
Might be worth alaborating why exactly. When I last looked over it I couldn't make much sense of it.
fs/xfs/xfs_bmap.c next_block: · line 6172
Quoted 7 lines
fs/xfs/xfs_bmap.c +7
-0+xfs_daddr_t +xfs_fsb_to_db (struct xfs_inode *ip,xfs_fsblock_t fsb) +{ +return (XFS_IS_REALTIME_INODE (ip) ? \ + (xfs_daddr_t )XFS_FSB_TO_BB ((ip)->i_mount, (fsb)) : \ +XFS_FSB_TO_DADDR ((ip)->i_mount, (fsb))); +}
Might be worth to "demacrofy" it while you're at it, e.g. rewrite it as:
xfs_daddr_txfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb)
{
if (XFS_IS_REALTIME_INODE(ip))
return XFS_FSB_TO_BB(ip->i_mount, fsb);
else
return XFS_FSB_TO_DADDR(ip->i_mount, fsb);
}_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 32/37] xfs: move xfs_get_extsz_hint() and kill xfs_rw.h
In reply to Dave ChinnerQuoted 9 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The only thing left in
xfs_rw.his a function prototype for an inode function. Move that toxfs_inode.h, and killxfs_rw.h.Also move the function implementing the prototype from
xfs_rw.ctoxfs_inode.cso we only have one function left inxfs_rw.cSigned-off-by Dave Chinner <[email protected]>
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 33/37] xfs: move xfs_do_force_shutdown() and kill xfs_rw.c
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
xfs-do-force_shutdown now is the only thing in
xfs_rw.c. There is no need to keep it in it's own file anymore, so move it toxfs_fsops.cnext toxfs_fs_goingdown()and killxfs_rw.c.
To me xfs_mount.c seems like the more reasonable place. Either way killing xfs_rw.c is a good thing.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 34/37] xfs: clean up xfs_bit.h includes
In reply to Dave Chinnerfs/xfs/xfs_ialloc.c xfs_ialloc_get_rec( · line 618
Quoted 9 lines
* Visible inode allocation functions.
*/fs/xfs/xfs_ialloc.c +7
-0+/* +* Find a free (set) bit in the inode bitmask. +*/ +static inline int xfs_ialloc_find_free (xfs_inofree_t *fp) +{ +return xfs_lowbit64 (*fp); +}
I'd suggest killing this helper entirely - there is just a single caller, and using the lowbit helper directly actually is even more obvious.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 35/37] xfs: Properly exclude IO type flags from buffer flags
In reply to Dave ChinnerQuoted 9 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Recent event tracing during a debugging session showed that flags that define the IO type for a buffer are leaking into the flags on the buffer incorrectly. Fix the flag exclusion mask in
xfs_buf_alloc()to avoid problems that may be caused by such leakage.Signed-off-by Dave Chinner <[email protected]>
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 36/37] xfs: flush outstanding buffers on log mount failure
In reply to Dave ChinnerQuoted 9 lines · Dave Chinner
From: Dave Chinner <[email protected]>
When we fail to mount the log in
xfs_mountfs(), we tear down all the infrastructure we have already allocated. However, the process of mounting the log may have progressed to the point of reading, caching and modifying buffers in memory. Hence before we can free all the infrastructure, we have to flush and remove all the buffers from memory.
Quoted 4 lines
Problem first reported by Eric Sandeen, later a different incarnation was reported by Ben Myers.
Signed-off-by Dave Chinner <[email protected]>
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 37/37] xfs: make XBF_MAPPED the default behaviour
In reply to Dave Chinnerfs/xfs/xfs_buf.c _xfs_buf_map_pages( · line 403
Quoted 8 lines
fs/xfs/xfs_buf.c +2
-2@@ -399,8 +399,9 @@ _xfs_buf_map_pages(if (bp->b_page_count ==1 ) {/* A single page buffer is always mappable */ bp->b_addr =page_address (bp->b_pages[0 ]) + bp->b_offset; - bp->b_flags |=XBF_MAPPED ; - }else if (flags &XBF_MAPPED ) { + }else if (flags &XBF_UNMAPPED ) { + bp->b_addr =NULL ;
Do we need this explicit assigned? The buffer should always have b_addr == NULL at this point.
Otherwise looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 28/37] xfs: move xfsagino_t to xfs_types.h
In reply to Christoph HellwigQuoted 10 lines · Christoph Hellwig
Quoted 6 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Untangle the header file includes a bit by moving the definition of
xfs_agino_ttoxfs_types.h. This removes the dependency thatxfs_ag.hhas onxfs_inum.h, meaning we don't need to includexfs_inum.heverywhere we includexfs_ag.h.This patch by itself looks good to me, but is there any good reason to keep
xfs_inum.haround at all?
I have that same question written down on my todo list. Seems like most of what remains could be added to xfs_ag.h or similar. One step at a time ;)
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 29/37 V3] xfs: move busy extent handling to it's own file
In reply to Christoph HellwigQuoted 2 lines · Christoph Hellwig
I would have called it
xfs_busy_extent.h, but given how far you are with the series it's really not worth bike sheeding about this detail.
I'm ambivalent, really. I used extent_busy to match the xfs_extfree_item.c naming. i.e. extent specific manipulations are in xfs_ext* namespace. It's pretty simple to change (a couple of search and replace), so if you'd prefer busy_extent I can change it pretty quickly...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 29/37 V3] xfs: move busy extent handling to it's own file
Quoted 9 lines · Dave Chinner
Quoted 2 lines · Christoph Hellwig
I would have called it
xfs_busy_extent.h, but given how far you are with the series it's really not worth bike sheeding about this detail.I'm ambivalent, really. I used
extent_busyto match thexfs_extfree_item.cnaming. i.e. extent specific manipulations are in xfs_ext* namespace. It's pretty simple to change (a couple of search and replace), so if you'd preferbusy_extentI can change it pretty quickly...
Actually, I just found a problem with this patch - xfs_alloc_busy_trim is not properly handled - so I've got to respin it. I'll change it all to busy_extent while I'm at it...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 31/37] xfs: move xfs_fsb_to_db to xfs_bmap.h
In reply to Christoph HellwigQuoted 7 lines · Christoph Hellwig
Quoted 3 lines · Dave Chinner
From: Dave Chinner <[email protected]>
This is the only remaining useful function in
xfs_rw.h, so move itWell,
xfs_get_extsz_hintalso still is useful, and you only move it in the next patch.
Ok, the only remaining useful -inline- function. :)
Quoted 8 lines
Quoted 5 lines
+/*
+ * Convert the given file system block to a disk block. We have to treat it
+ * differently based on whether the file is a real time file or not, because the
+ * bmap code does.
+ */Might be worth alaborating why exactly. When I last looked over it I couldn't make much sense of it.
realtime device is a flat filesysetm block address space - it has to be for a bitmap allocator to work - but the data device is a sparse address space. I'll add that to the comment.
Quoted 10 lines
fs/xfs/xfs_bmap.c next_block: · line 6172
Quoted 8 lines
fs/xfs/xfs_bmap.c +7
-0+xfs_daddr_t +xfs_fsb_to_db (struct xfs_inode *ip,xfs_fsblock_t fsb) +{ +return (XFS_IS_REALTIME_INODE (ip) ? \ + (xfs_daddr_t )XFS_FSB_TO_BB ((ip)->i_mount, (fsb)) : \ +XFS_FSB_TO_DADDR ((ip)->i_mount, (fsb))); +}Might be worth to "demacrofy" it while you're at it, e.g. rewrite it as:
*nod*. Will do.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 33/37] xfs: move xfs_do_force_shutdown() and kill xfs_rw.c
In reply to Christoph HellwigQuoted 8 lines · Christoph Hellwig
Quoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
xfs-do-force_shutdown now is the only thing in
xfs_rw.c. There is no need to keep it in it's own file anymore, so move it toxfs_fsops.cnext toxfs_fs_goingdown()and killxfs_rw.c.To me
xfs_mount.cseems like the more reasonable place.
It is not used in userspace, so rather than place it in a file that userspace shares (xfs_mount.c) and have to deal with that every merge, I moved it to a file that is not shared with userspace. Placing it with other shutdown code (xfs_fs_goingdown()) seemed like a reasonable thing to do...
Quoted 1 line
Either way killing
xfs_rw.cis a good thing.
*nod*
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 37/37] xfs: make XBF_MAPPED the default behaviour
In reply to Christoph HellwigQuoted 11 lines · Christoph Hellwig
fs/xfs/xfs_buf.c _xfs_buf_map_pages( · line 403
Quoted 8 lines
fs/xfs/xfs_buf.c +2
-2@@ -399,8 +399,9 @@ _xfs_buf_map_pages(if (bp->b_page_count ==1 ) {/* A single page buffer is always mappable */ bp->b_addr =page_address (bp->b_pages[0 ]) + bp->b_offset; - bp->b_flags |=XBF_MAPPED ; - }else if (flags &XBF_MAPPED ) { + }else if (flags &XBF_UNMAPPED ) { + bp->b_addr =NULL ;Do we need this explicit assigned? The buffer should always have
b_addr== NULL at this point.
True. I'll change it to an ASSERT.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 34/37] xfs: clean up xfs_bit.h includes
In reply to Christoph HellwigQuoted 5 lines · Christoph Hellwig
Quoted 5 lines
* Visible inode allocation functions.
*/
+/*
+ * Find a free (set) bit in the inode bitmask.
+ */
Quoted 8 lines
fs/xfs/xfs_ialloc.c xfs_ialloc_get_rec( · line 618
Quoted 4 lines
fs/xfs/xfs_ialloc.c +4
-0+static inline int xfs_ialloc_find_free (xfs_inofree_t *fp) +{ +return xfs_lowbit64 (*fp); +}I'd suggest killing this helper entirely - there is just a single caller, and using the lowbit helper directly actually is even more obvious.
Ok. Done.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Dave,
Quoted 10 lines · Dave Chinner
Quoted 9 lines · Ben Myers
Quoted 7 lines · Dave Chinner
I haven't been able to reproduce Ben's CIL commit sequence assert failure from the async log flushing patch (patch 12/37), so whatever the cause of that problem is is still unknown.
[ Actually, as I wrote this I had a concurrent rm -rf just trip this assert, so the problem is real and I've obviously got more work to do on this one.... ]
Quoted 6 lines
Quoted 4 lines
I just hit it again, looks like in test 273.
[ 6587.548841] XFS: Assertion failed: push_seq > 0 && push_seq <= ctx->sequence, file: /root/xfs/fs/xfs/xfs_log_cil.c, line: 405This time I have a dump. ;)
Try version 2 of the patch (#12)....
Yep, with version 2 I haven't seen this in awhile.
-Ben
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Assertion failed: RB_EMPTY_NODE(&bp->b_rbnode)
In reply to Dave ChinnerWhile testing this patchset without Jan's freeze work, I hit this assert. I believe I have not seen this one before.
-Ben
[36850.416217] XFS: Assertion failed: RB_EMPTY_NODE(&bp->b_rbnode), file: /work/xfs/fs/xfs/xfs_buf.c, line: 838 [36850.445669] BUG: unable to handle kernel NULL pointer dereference at 0000000000000038 [36850.446633] IP: [<ffffffff816ef359>] _raw_spin_lock+0x9/0x30 [36850.446633] PGD 1291e5067 PUD 129a9f067 PMD 0 [36850.446633] Oops: 0002 [#1] SMP [36850.446633] CPU 0 [36850.446633] Modules linked in: xfs(O) nfsd exportfs e1000e [36850.446633] [36850.446633] Pid: 20529, comm: kworker/0:10 Tainted: G O 3.4.0-rc2+ #3 SGI.COM AltixXE310/X7DGT-INF [36850.446633] RIP: 0010:[<ffffffff816ef359>] [<ffffffff816ef359>] _raw_spin_lock+0x9/0x30 [36850.446633] RSP: 0018:ffff880106e6fb40 EFLAGS: 00010286 [36850.446633] RAX: 0000000000000100 RBX: ffff880121c0fba0 RCX: 0000000000000000 [36850.446633] RDX: 0000007800004e53 RSI: ffff880121c0fba0 RDI: 0000000000000038 [36850.446633] RBP: ffff880106e6fb40 R08: ffff88010c209b00 R09: 0000000000000000 [36850.446633] R10: 0000000000000800 R11: 0000000000000001 R12: ffff88010c209580 [36850.446633] R13: ffff880127711300 R14: ffff880127711330 R15: ffff88012852c780 [36850.446633] FS: 0000000000000000(0000) GS:ffff88012fc00000(0000) knlGS:0000000000000000 [36850.446633] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [36850.446633] CR2: 0000000000000038 CR3: 0000000129bd3000 CR4: 00000000000007f0 [36850.446633] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [36850.446633] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [36850.446633] Process kworker/0:10 (pid: 20529, threadinfo ffff880106e6e000, task ffff88011931ba80) [36850.446633] Stack: [36850.446633] ffff880106e6fcd0 ffffffffa00bc531 0000000000000400 0000000000001000 [36850.446633] 0000000000000000 0000007800004e53 0000000000000000 0000000000000038 [36850.446633] ffff880106e6fba0 ffffffff8126b923 0000000000000040 ffff88012b004880 [36850.446633] Call Trace: [36850.446633] [<ffffffffa00bc531>] xfs_trans_committed_bulk+0x41/0x300 [xfs] [36850.446633] [<ffffffff8126b923>] ? cpumask_next_and+0x23/0x40 [36850.446633] [<ffffffff8106c5f7>] ? select_task_rq_fair+0x547/0xa00 [36850.446633] [<ffffffff8106d205>] ? enqueue_task_fair+0x135/0x520 [36850.446633] [<ffffffff81065911>] ? enqueue_task+0x61/0x70 [36850.446633] [<ffffffff81063e25>] ? check_preempt_curr+0x85/0xa0 [36850.446633] [<ffffffff8106b5d8>] ? update_curr+0x158/0x1b0 [36850.446633] [<ffffffffa00c24f6>] xlog_cil_committed+0x36/0x130 [xfs] [36850.446633] [<ffffffffa00be07d>] xlog_state_do_callback+0x16d/0x390 [xfs] [36850.446633] [<ffffffffa00be387>] xlog_state_done_syncing+0xe7/0x110 [xfs] [36850.446633] [<ffffffffa00beb8e>] xlog_iodone+0x7e/0x100 [xfs] [36850.446633] [<ffffffffa005a2d1>] xfs_buf_iodone_work+0x21/0x50 [xfs] [36850.446633] [<ffffffff81051498>] process_one_work+0x158/0x440 [36850.446633] [<ffffffffa005a2b0>] ? xfs_bioerror_relse+0x80/0x80 [xfs] [36850.446633] [<ffffffff8105428b>] worker_thread+0x17b/0x410 [36850.446633] [<ffffffff81054110>] ? manage_workers+0x200/0x200 [36850.446633] [<ffffffff81058bce>] kthread+0x9e/0xb0 [36850.446633] [<ffffffff816f8014>] kernel_thread_helper+0x4/0x10 [36850.446633] [<ffffffff81058b30>] ? kthread_freezable_should_stop+0x70/0x70 [36850.446633] [<ffffffff816f8010>] ? gs_change+0xb/0xb [36850.446633] Code: 89 c8 f0 66 0f b1 37 66 39 c1 c9 0f 94 c0 0f b6 d0 89 d0 c3 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 55 b8 00 01 00 00 48 89 e5 <f0> 66 0f c1 07 89 c2 66 c1 ea 08 38 d0 74 11 0f 1f 84 00 00 00 [36850.446633] RIP [<ffffffff816ef359>] _raw_spin_lock+0x9/0x30 [36850.446633] RSP <ffff880106e6fb40> [36850.446633] CR2: 0000000000000038 [36851.384076] ---[ end trace ef4b0c0782ed6ecf ]--- [36851.397935] ------------[ cut here ]------------ [36851.411775] kernel BUG at /work/xfs/fs/xfs/xfs_message.c:100! [36851.411777] invalid opcode: 0000 [#2] SMP [36851.411779] CPU 0 [36851.411779] Modules linked in: xfs(O) nfsd exportfs e1000e [36851.411782] [36851.411784] Pid: 20533, comm: kworker/0:14 Tainted: G D O 3.4.0-rc2+ #3 SGI.COM AltixXE310/X7DGT-INF [36851.411786] RIP: 0010:[<ffffffffa00688dd>] [<ffffffffa00688dd>] assfail+0x1d/0x30 [xfs] [36851.411797] RSP: 0018:ffff8801051a7bf0 EFLAGS: 00010286 [36851.411798] RAX: 0000000000000076 RBX: ffff880121c14500 RCX: 0000000000000082 [36851.411799] RDX: 0000000000000075 RSI: 0000000000000046 RDI: ffffffff81d79538 [36851.411801] RBP: ffff8801051a7bf0 R08: 0000000000000000 R09: 0000000000000000 [36851.411802] R10: 00000000ffffffff R11: 0000000000000000 R12: ffff880121c14500 [36851.411804] R13: ffffffffa005a54b R14: 0000000000000000 R15: 0000000000000002 [36851.411806] FS: 0000000000000000(0000) GS:ffff88012fc00000(0000) knlGS:0000000000000000 [36851.411807] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [36851.411809] CR2: 0000000000000038 CR3: 0000000129bd3000 CR4: 00000000000007f0 [36851.411810] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [36851.411812] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [36851.411813] Process kworker/0:14 (pid: 20533, threadinfo ffff8801051a6000, task ffff88011931d7c0) [36851.411815] Stack: [36851.411815] ffff8801051a7c20 ffffffffa0059859 ffff880121c14500 ffff880121c14500 [36851.411818] ffffffffa00be58e ffff88010c209500 ffff8801051a7c50 ffffffffa005a54b [36851.411820] ffff8801051a7c60 ffff880121c14500 ffff880103ff3800 ffff88012fc12cc0 [36851.411822] Call Trace: [36851.411829] [<ffffffffa0059859>] xfs_buf_rele+0x179/0x1b0 [xfs] [36851.411838] [<ffffffffa00be58e>] ? xlog_bdstrat+0x1e/0x60 [xfs] [36851.411845] [<ffffffffa005a54b>] xfs_buf_iorequest+0xab/0xc0 [xfs] [36851.411854] [<ffffffffa00be58e>] xlog_bdstrat+0x1e/0x60 [xfs] [36851.411863] [<ffffffffa00c0080>] xlog_sync+0x350/0x540 [xfs] [36851.411872] [<ffffffffa00c032a>] xlog_state_release_iclog+0xba/0x130 [xfs] [36851.411881] [<ffffffffa00c093f>] _xfs_log_force_lsn+0x20f/0x2a0 [xfs] [36851.411884] [<ffffffff81068cc0>] ? try_to_wake_up+0x280/0x280 [36851.411893] [<ffffffffa00bcde3>] xfs_trans_commit+0x293/0x2a0 [xfs] [36851.411900] [<ffffffffa005f74b>] xfs_fs_log_dummy+0x5b/0x80 [xfs] [36851.411910] [<ffffffffa006ba1c>] xfs_sync_worker+0x8c/0xa0 [xfs] [36851.411912] [<ffffffff81051498>] process_one_work+0x158/0x440 [36851.411921] [<ffffffffa006b990>] ? xfs_flush_inodes+0x40/0x40 [xfs] [36851.411923] [<ffffffff8105428b>] worker_thread+0x17b/0x410 [36851.411925] [<ffffffff81054110>] ? manage_workers+0x200/0x200 [36851.411927] [<ffffffff81058bce>] kthread+0x9e/0xb0 [36851.411930] [<ffffffff816f8014>] kernel_thread_helper+0x4/0x10 [36851.411932] [<ffffffff81058b30>] ? kthread_freezable_should_stop+0x70/0x70 [36851.411934] [<ffffffff816f8010>] ? gs_change+0xb/0xb [36851.411935] Code: 00 00 00 48 89 45 c8 e8 72 fc ff ff c9 c3 55 41 89 d0 48 89 f1 48 89 fa 48 c7 c6 d0 f3 0d a0 31 ff 48 89 e5 31 c0 e8 93 ff ff ff <0f> 0b eb fe 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 55 4c [36851.411950] RIP [<ffffffffa00688dd>] assfail+0x1d/0x30 [xfs] [36851.411958] RSP <ffff8801051a7bf0> [36851.411960] ---[ end trace ef4b0c0782ed6ed0 ]--- [36851.411993] BUG: unable to handle kernel paging request at fffffffffffffff8 [36851.411995] IP: [<ffffffff810586ab>] kthread_data+0xb/0x20 [36851.411998] PGD 1c0e067 PUD 1c0f067 PMD 0 [36851.412000] Oops: 0000 [#3] SMP [36851.412001] CPU 0 [36851.412002] Modules linked in: xfs(O) nfsd exportfs e1000e [36851.412004] [36851.412006] Pid: 20533, comm: kworker/0:14 Tainted: G D O 3.4.0-rc2+ #3 SGI.COM AltixXE310/X7DGT-INF [36851.412008] RIP: 0010:[<ffffffff810586ab>] [<ffffffff810586ab>] kthread_data+0xb/0x20 [36851.412011] RSP: 0018:ffff8801051a77e8 EFLAGS: 00010092 [36851.412012] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000012acd60aa60 [36851.412013] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88011931d7c0 [36851.412015] RBP: ffff8801051a77e8 R08: ffff88012fc0d248 R09: 0000000000000000 [36851.412016] R10: 0000000000000800 R11: 0000000000000001 R12: ffff88011931db48 [36851.412018] R13: ffff88012fc120c0 R14: 0000000000000000 R15: ffff88011931da50 [36851.412020] FS: 0000000000000000(0000) GS:ffff88012fc00000(0000) knlGS:0000000000000000 [36851.412021] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [36851.412023] CR2: fffffffffffffff8 CR3: 0000000129bd3000 CR4: 00000000000007f0 [36851.412024] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [36851.412026] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [36851.412027] Process kworker/0:14 (pid: 20533, threadinfo ffff8801051a6000, task ffff88011931d7c0) [36851.412029] Stack: [36851.412029] ffff8801051a7808 ffffffff81052680 ffff8801051a7808 ffff88011931d7c0 [36851.412032] ffff8801051a7948 ffffffff816ee4df ffff8801051a6010 00000000000120c0 [36851.412034] 00000000000120c0 ffff88011931d7c0 00000000000120c0 ffff8801051a7fd8 [36851.412036] Call Trace: [36851.412038] [<ffffffff81052680>] wq_worker_sleeping+0x10/0xa0 [36851.412040] [<ffffffff816ee4df>] __schedule+0x64f/0x810 [36851.412042] [<ffffffff81051c49>] ? __queue_work+0x219/0x400 [36851.412044] [<ffffffff81051e76>] ? queue_work_on+0x16/0x20 [36851.412046] [<ffffffff81051eba>] ? queue_work+0x1a/0x20 [36851.412049] [<ffffffff81259392>] ? put_io_context+0x62/0x90 [36851.412051] [<ffffffff816ee994>] schedule+0x24/0x70 [36851.412054] [<ffffffff8103c926>] do_exit+0x676/0xa00 [36851.412056] [<ffffffff816f04cc>] oops_end+0xdc/0xe0 [36851.412059] [<ffffffff81005676>] die+0x56/0x90 [36851.412061] [<ffffffff816f0098>] do_trap+0x148/0x160 [36851.412064] [<ffffffff816f2d65>] ? atomic_notifier_call_chain+0x15/0x20 [36851.412071] [<ffffffffa005a54b>] ? xfs_buf_iorequest+0xab/0xc0 [xfs] [36851.412073] [<ffffffff810033c0>] do_invalid_op+0x90/0xb0 [36851.412082] [<ffffffffa00688dd>] ? assfail+0x1d/0x30 [xfs] [36851.412089] [<ffffffffa005a54b>] ? xfs_buf_iorequest+0xab/0xc0 [xfs] [36851.412091] [<ffffffff816ec899>] ? printk+0x3c/0x3e [36851.412094] [<ffffffff816f7e95>] invalid_op+0x15/0x20 [36851.412100] [<ffffffffa005a54b>] ? xfs_buf_iorequest+0xab/0xc0 [xfs] [36851.412109] [<ffffffffa00688dd>] ? assfail+0x1d/0x30 [xfs] [36851.412116] [<ffffffffa0059859>] xfs_buf_rele+0x179/0x1b0 [xfs] [36851.412124] [<ffffffffa00be58e>] ? xlog_bdstrat+0x1e/0x60 [xfs] [36851.412131] [<ffffffffa005a54b>] xfs_buf_iorequest+0xab/0xc0 [xfs] [36851.412140] [<ffffffffa00be58e>] xlog_bdstrat+0x1e/0x60 [xfs] [36851.412149] [<ffffffffa00c0080>] xlog_sync+0x350/0x540 [xfs] [36851.412157] [<ffffffffa00c032a>] xlog_state_release_iclog+0xba/0x130 [xfs] [36851.412166] [<ffffffffa00c093f>] _xfs_log_force_lsn+0x20f/0x2a0 [xfs] [36851.412168] [<ffffffff81068cc0>] ? try_to_wake_up+0x280/0x280 [36851.412177] [<ffffffffa00bcde3>] xfs_trans_commit+0x293/0x2a0 [xfs] [36851.412184] [<ffffffffa005f74b>] xfs_fs_log_dummy+0x5b/0x80 [xfs] [36851.412193] [<ffffffffa006ba1c>] xfs_sync_worker+0x8c/0xa0 [xfs] [36851.412195] [<ffffffff81051498>] process_one_work+0x158/0x440 [36851.412204] [<ffffffffa006b990>] ? xfs_flush_inodes+0x40/0x40 [xfs] [36851.412206] [<ffffffff8105428b>] worker_thread+0x17b/0x410 [36851.412208] [<ffffffff81054110>] ? manage_workers+0x200/0x200 [36851.412210] [<ffffffff81058bce>] kthread+0x9e/0xb0 [36851.412212] [<ffffffff816f8014>] kernel_thread_helper+0x4/0x10 [36851.412215] [<ffffffff81058b30>] ? kthread_freezable_should_stop+0x70/0x70 [36851.412217] [<ffffffff816f8010>] ? gs_change+0xb/0xb [36851.412218] Code: 55 65 48 8b 04 25 40 b7 00 00 48 8b 80 30 03 00 00 48 89 e5 8b 40 f0 c9 c3 0f 1f 80 00 00 00 00 48 8b 87 30 03 00 00 55 48 89 e5 <48> 8b 40 f8 c9 c3 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 [36851.412233] RIP [<ffffffff810586ab>] kthread_data+0xb/0x20 [36851.412235] RSP <ffff8801051a77e8> [36851.412236] CR2: fffffffffffffff8 [36851.412237] ---[ end trace ef4b0c0782ed6ed1 ]--- [36851.412238] Fixing recursive fault but reboot is needed!
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
While testing this patchset without Jan's freeze work, I hit this assert.
This one rings bells for me, but I can't find where it's been reported.
-Ben
[56571.411824] BUG: unable to handle kernel NULL pointer dereference at 0000000000000028 [56571.412798] IP: [<ffffffffa00bf477>] xfs_log_space_wake+0x17/0x140 [xfs] [56571.412798] PGD 0 [56571.412798] Oops: 0000 [#1] SMP [56571.412798] CPU 3 [56571.412798] Modules linked in: xfs(O) nfsd exportfs e1000e [56571.412798] [56571.412798] Pid: 14544, comm: kworker/3:25 Tainted: G O 3.4.0-rc2+ #3 SGI.COM AltixXE310/X7DGT-INF [56571.412798] RIP: 0010:[<ffffffffa00bf477>] [<ffffffffa00bf477>] xfs_log_space_wake+0x17/0x140 [xfs] [56571.412798] RSP: 0018:ffff8801204a7ce0 EFLAGS: 00010282 [56571.412798] RAX: ffff88010fdd3de8 RBX: ffff88010a4971c0 RCX: 0000000000000000 [56571.412798] RDX: ffff88010fdd3de8 RSI: 0000000000000282 RDI: ffff88010fdd3580 [56571.412798] RBP: ffff8801204a7d00 R08: ffff88010fdd3dd0 R09: 0000000000000000 [56571.412798] R10: 0000000000000400 R11: 0000000000000001 R12: 0000000000000000 [56571.412798] R13: 0000000000000001 R14: ffff8801204a7d80 R15: ffff88010fdd3d80 [56571.412798] FS: 0000000000000000(0000) GS:ffff88012fd80000(0000) knlGS:0000000000000000 [56571.412798] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [56571.412798] CR2: 0000000000000028 CR3: 0000000001c0c000 CR4: 00000000000007e0 [56571.412798] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [56571.412798] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [56571.412798] Process kworker/3:25 (pid: 14544, threadinfo ffff8801204a6000, task ffff880101750750) [56571.412798] Stack: [56571.412798] ffff88010fdd3da8 0000000000000001 ffff88010a4971c0 ffff88010fdd3da8 [56571.412798] ffff8801204a7d60 ffffffffa00c64ef 0000000000000000 0000000100000008 [56571.412798] ffff88010a4971c0 0000000181063e35 ffff88010fdd3d90 ffff88010a4971c0 [56571.412798] Call Trace: [56571.412798] [<ffffffffa00c64ef>] xfs_trans_ail_delete_bulk+0x14f/0x1e0 [xfs] [56571.412798] [<ffffffffa00c31c7>] xfs_buf_iodone+0x67/0x90 [xfs] [56571.412798] [<ffffffff810663fc>] ? ttwu_do_activate+0x4c/0x60 [56571.412798] [<ffffffffa00c2d9c>] xfs_buf_do_callbacks+0x5c/0x70 [xfs] [56571.412798] [<ffffffffa00c2f49>] xfs_buf_iodone_callbacks+0x39/0x230 [xfs] [56571.412798] [<ffffffffa005a2d1>] xfs_buf_iodone_work+0x21/0x50 [xfs] [56571.412798] [<ffffffff81051498>] process_one_work+0x158/0x440 [56571.412798] [<ffffffffa005a2b0>] ? xfs_bioerror_relse+0x80/0x80 [xfs] [56571.412798] [<ffffffff8105428b>] worker_thread+0x17b/0x410 [56571.412798] [<ffffffff81054110>] ? manage_workers+0x200/0x200 [56571.412798] [<ffffffff81058bce>] kthread+0x9e/0xb0 [56571.412798] [<ffffffff816f8014>] kernel_thread_helper+0x4/0x10 [56571.412798] [<ffffffff81058b30>] ? kthread_freezable_should_stop+0x70/0x70 [56571.412798] [<ffffffff816f8010>] ? gs_change+0xb/0xb [56571.412798] Code: 5e 41 5f c9 c3 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 48 83 ec 20 48 89 5d f0 4c 89 65 f8 4c 8b a7 40 01 00 00 <41> 8b 54 24 28 f6 c2 08 0f 85 db 00 00 00 49 8d 84 24 88 01 00 [56571.412798] RIP [<ffffffffa00bf477>] xfs_log_space_wake+0x17/0x140 [xfs] [56571.412798] RSP <ffff8801204a7ce0> [56571.412798] CR2: 0000000000000028 [56572.245080] ---[ end trace 389bb5c2de2235a4 ]--- [56572.258912] BUG: unable to handle kernel paging request at fffffffffffffff8 [56572.270001] IP: [<ffffffff810586ab>] kthread_data+0xb/0x20 [56572.270001] PGD 1c0e067 PUD 1c0f067 PMD 0 [56572.270001] Oops: 0000 [#2] SMP [56572.270001] CPU 3 [56572.270001] Modules linked in: xfs(O) nfsd exportfs e1000e [56572.270001] [56572.270001] Pid: 14544, comm: kworker/3:25 Tainted: G D O 3.4.0-rc2+ #3 SGI.COM AltixXE310/X7DGT-INF [56572.270001] RIP: 0010:[<ffffffff810586ab>] [<ffffffff810586ab>] kthread_data+0xb/0x20 [56572.270001] RSP: 0018:ffff8801204a7838 EFLAGS: 00010096 [56572.270001] RAX: 0000000000000000 RBX: 0000000000000003 RCX: 00000698cbadbdda [56572.270001] RDX: 0000000000000003 RSI: 0000000000000003 RDI: ffff880101750750 [56572.270001] RBP: ffff8801204a7838 R08: ffff88012fd8d248 R09: 0000000000000000 [56572.270001] R10: 0000000000000400 R11: 0000000000000001 R12: ffff880101750ad8 [56572.270001] R13: ffff88012fd920c0 R14: 0000000000000003 R15: ffff8801017509e0 [56572.270001] FS: 0000000000000000(0000) GS:ffff88012fd80000(0000) knlGS:0000000000000000 [56572.270001] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [56572.270001] CR2: fffffffffffffff8 CR3: 0000000001c0c000 CR4: 00000000000007e0 [56572.270001] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [56572.270001] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [56572.270001] Process kworker/3:25 (pid: 14544, threadinfo ffff8801204a6000, task ffff880101750750) [56572.270001] Stack: [56572.270001] ffff8801204a7858 ffffffff81052680 ffff8801204a7858 ffff880101750750 [56572.270001] ffff8801204a7998 ffffffff816ee4df ffff8801204a6010 00000000000120c0 [56572.270001] 00000000000120c0 ffff880101750750 00000000000120c0 ffff8801204a7fd8 [56572.270001] Call Trace: [56572.270001] [<ffffffff81052680>] wq_worker_sleeping+0x10/0xa0 [56572.270001] [<ffffffff816ee4df>] __schedule+0x64f/0x810 [56572.270001] [<ffffffff81051c49>] ? __queue_work+0x219/0x400 [56572.270001] [<ffffffff8113ab77>] ? d_hash_and_lookup+0x37/0x70 [56572.270001] [<ffffffff81051e76>] ? queue_work_on+0x16/0x20 [56572.270001] [<ffffffff81051eba>] ? queue_work+0x1a/0x20 [56572.270001] [<ffffffff81259392>] ? put_io_context+0x62/0x90 [56572.270001] [<ffffffff816ee994>] schedule+0x24/0x70 [56572.270001] [<ffffffff8103c926>] do_exit+0x676/0xa00 [56572.270001] [<ffffffff816f04cc>] oops_end+0xdc/0xe0 [56572.270001] [<ffffffff8102c7a8>] no_context+0x118/0x2e0 [56572.270001] [<ffffffff8102ca9d>] __bad_area_nosemaphore+0x12d/0x200 [56572.270001] [<ffffffff8102cb7e>] bad_area_nosemaphore+0xe/0x10 [56572.270001] [<ffffffff816f2b8e>] do_page_fault+0x34e/0x480 [56572.270001] [<ffffffff816ef9af>] page_fault+0x1f/0x30 [56572.270001] [<ffffffffa00bf477>] ? xfs_log_space_wake+0x17/0x140 [xfs] [56572.270001] [<ffffffffa00c64ef>] xfs_trans_ail_delete_bulk+0x14f/0x1e0 [xfs] [56572.270001] [<ffffffffa00c31c7>] xfs_buf_iodone+0x67/0x90 [xfs] [56572.270001] [<ffffffff810663fc>] ? ttwu_do_activate+0x4c/0x60 [56572.270001] [<ffffffffa00c2d9c>] xfs_buf_do_callbacks+0x5c/0x70 [xfs] [56572.270001] [<ffffffffa00c2f49>] xfs_buf_iodone_callbacks+0x39/0x230 [xfs] [56572.270001] [<ffffffffa005a2d1>] xfs_buf_iodone_work+0x21/0x50 [xfs] [56572.270001] [<ffffffff81051498>] process_one_work+0x158/0x440 [56572.270001] [<ffffffffa005a2b0>] ? xfs_bioerror_relse+0x80/0x80 [xfs] [56572.270001] [<ffffffff8105428b>] worker_thread+0x17b/0x410 [56572.270001] [<ffffffff81054110>] ? manage_workers+0x200/0x200 [56572.270001] [<ffffffff81058bce>] kthread+0x9e/0xb0 [56572.270001] [<ffffffff816f8014>] kernel_thread_helper+0x4/0x10 [56572.270001] [<ffffffff81058b30>] ? kthread_freezable_should_stop+0x70/0x70 [56572.270001] [<ffffffff816f8010>] ? gs_change+0xb/0xb [56572.270001] Code: 55 65 48 8b 04 25 40 b7 00 00 48 8b 80 30 03 00 00 48 89 e5 8b 40 f0 c9 c3 0f 1f 80 00 00 00 00 48 8b 87 30 03 00 00 55 48 89 e5 <48> 8b 40 f8 c9 c3 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 [56572.270001] RIP [<ffffffff810586ab>] kthread_data+0xb/0x20 [56572.270001] RSP <ffff8801204a7838> [56572.270001] CR2: fffffffffffffff8 [56572.270001] ---[ end trace 389bb5c2de2235a5 ]--- [56572.270001] Fixing recursive fault but reboot is needed!
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 13 lines · Dave Chinner
Quoted 11 lines · Ben Myers
I'm also testing this patch set them without Jan's work, since I'm not sure when it will be pulled in. Here's the latest:
case login: [ 2934.077472] BUG: unable to handle kernel paging request at
ffffc900036a8010[ 2934.078452] IP: [<ffffffffa009a790>] xlog_get_lowest_lsn+0x30/0x80 [xfs] [ 2934.078452] PGD 12b029067 PUD 12b02a067 PMD 378f5067 PTE 0 [ 2934.078452] Oops: 0000 [#1] SMP [ 2934.078452] CPU 1 [ 2934.078452] Modules linked in: xfs(O) exportfs e1000e [last unloaded: xfs] [ 2934.078452] [ 2934.078452] Pid: 9031, comm: kworker/1:15 Tainted: G O 3.4.0-rc2+ #3 SGI.COM AltixXE310/X7DGT-INF
Quoted 2 lines
What out-of-tree module do you have loaded that tainted the kernel? The ethernet driver?
I tend to build xfs out of tree and then 'insmod ./xfs.ko'.
Documentation/sysctl/kernel.txt:
4096 - An out-of-tree module has been loaded
# cat /proc/sys/kernel/tainted 4096
-Ben
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Any chance you could order the patches not depending on my buffer work first? Given that it still trips up some problems getting the easier patches in ASAP would be a good thing. That especially applies to the SEEK_HOLE and project+group quota patches that I'd really not like to see beeing skipped again this round.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 14 lines · Ben Myers
Quoted 13 lines · Dave Chinner
Quoted 11 lines · Ben Myers
I'm also testing this patch set them without Jan's work, since I'm not sure when it will be pulled in. Here's the latest:
case login: [ 2934.077472] BUG: unable to handle kernel paging request at
ffffc900036a8010[ 2934.078452] IP: [<ffffffffa009a790>] xlog_get_lowest_lsn+0x30/0x80 [xfs] [ 2934.078452] PGD 12b029067 PUD 12b02a067 PMD 378f5067 PTE 0 [ 2934.078452] Oops: 0000 [#1] SMP [ 2934.078452] CPU 1 [ 2934.078452] Modules linked in: xfs(O) exportfs e1000e [last unloaded: xfs] [ 2934.078452] [ 2934.078452] Pid: 9031, comm: kworker/1:15 Tainted: G O 3.4.0-rc2+ #3 SGI.COM AltixXE310/X7DGT-INF
Quoted 4 lines
Quoted 2 lines
What out-of-tree module do you have loaded that tainted the kernel? The ethernet driver?
I tend to build xfs out of tree and then 'insmod ./xfs.ko'.
Ok, do you rmmod the xfs.ko module and insert new ones, or just reboot whenever you have a new module for testing? I'm assuming that you are unloading and reloading based on the "[last unloaded: xfs]" above. That has always made me nervous about memory corruption intorudced by a previous module affecting the running of a current module....
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: Assertion failed: RB_EMPTY_NODE(&bp->b_rbnode)
In reply to Ben MyersQuoted 7 lines · Ben Myers
While testing this patchset without Jan's freeze work, I hit this assert. I believe I have not seen this one before.
-Ben
[36850.416217] XFS: Assertion failed: RB_EMPTY_NODE(&bp->b_rbnode), file: /work/xfs/fs/xfs/xfs_buf.c, line: 838 [36850.445669] BUG: unable to handle kernel NULL pointer dereference at 0000000000000038
Two problems - the BUG seems to be one that you have reported before, while the assert failure tends to indicate a use after free situation on a buffer (i.e. a log buffer has been torn down while IO is still in progress). That smells like different symptoms of the same problem....
I think you are going to have to debug this one, Ben, because I have not seen anything at all like these problems on any of my test or stress workloads. I don't even know what test you are running at the time these failures are occurring, so I can't even start looking...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 9 lines · Ben Myers
While testing this patchset without Jan's freeze work, I hit this assert.
This one rings bells for me, but I can't find where it's been reported.
-Ben
[56571.411824] BUG: unable to handle kernel NULL pointer dereference at 0000000000000028 [56571.412798] IP: [<ffffffffa00bf477>] xfs_log_space_wake+0x17/0x140 [xfs]
Which is failing on this:
(gdb) l *(xfs_log_space_wake+0x17)0xffffffff81482cb7 is in xfs_log_space_wake (fs/xfs/xfs_log.c:844).
839 struct xfs_mount *mp)
840 {
841 struct log *log = mp->m_log; 842 int free_bytes;
843
844 >>>>>>> if (XLOG_FORCED_SHUTDOWN(log))
845 return;
On this offset:
$ pahole fs/xfs/xfs_log.o |grep -A 6 "^struct log"
struct log {
struct xfs_mount * l_mp; /* 0 8 */
struct xfs_ail * l_ailp; /* 8 8 */
struct xfs_cil * l_cilp; /* 16 8 */
struct xfs_buf * l_xbuf; /* 24 8 */
struct xfs_buftarg * l_targ; /* 32 8 */
uint l_flags; /* 40 4 */
^^^^^^^^^^^^^^^^^So the log pointer passed is NULL. That's the first definite sign that the problems you are seeing are all a result of log buffer IO completing after the log has been torn down.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs