a couple more random cleanups for 2.6.30
cover a couple more random cleanups for 2.6.30
Misc patch queue.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/7 xfs: cleanup log unmount handling
Kill the current xfs_log_unmount wrapper and opencode the two function calls in the only caller. Rename the current xfs_log_unmount_dealloc to xfs_log_unmount as it undoes xfs_log_mount and the new name makes that more clear.
fs/xfs/xfs_log.c +1 -14
@@ -635,19 +635,6 @@ xfs_log_mount_finish(xfs_mount_t *mp) }/* -* Unmount processing for the log. -*/ -int -xfs_log_unmount (xfs_mount_t *mp) -{ -int error; - - error =xfs_log_unmount_write (mp); -xfs_log_unmount_dealloc (mp); -return error; -} - -/* * Final log writes as part of unmount. * * Mark the filesystem clean as unmount happens. Note that during relocation
@@ -797,7 +784,7 @@ xfs_log_unmount_write(xfs_mount_t *mp)* and deallocate the log as the aild references the log. */ void -xfs_log_unmount_dealloc (xfs_mount_t *mp) +xfs_log_unmount (xfs_mount_t *mp) {xfs_trans_ail_destroy (mp);xlog_dealloc_log (mp->m_log);
fs/xfs/xfs_log.h +1 -2
@@ -170,9 +170,8 @@ int xfs_log_write(struct xfs_mount *mpint nentries, xfs_log_ticket_t ticket, xfs_lsn_t *start_lsn); -int xfs_log_unmount (struct xfs_mount *mp);int xfs_log_unmount_write (struct xfs_mount *mp); -void xfs_log_unmount_dealloc (struct xfs_mount *mp); +void xfs_log_unmount (struct xfs_mount *mp);int xfs_log_force_umount (struct xfs_mount *mp,int logerror);int xfs_log_need_covered (struct xfs_mount *mp);
fs/xfs/xfs_mount.c +3 -2
@@ -1194,7 +1194,7 @@ xfs_mountfs( out_rele_rip:IRELE (rip); out_log_dealloc: -xfs_log_unmount_dealloc (mp); +xfs_log_unmount (mp); out_free_perag:xfs_free_perag (mp); out_remove_uuid:
@@ -1280,7 +1280,8 @@ xfs_unmountfs( "Freespace may not be correct on next mount.");xfs_unmountfs_writesb (mp);xfs_unmountfs_wait (mp);/* wait for async bufs */ -xfs_log_unmount (mp);/* Done! No more fs ops. */ +xfs_log_unmount_write (mp); +xfs_log_unmount (mp);if ((mp->m_flags &XFS_MOUNT_NOUUID ) ==0 )uuid_table_remove (&mp->m_sb.sb_uuid);
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 1/7] xfs: cleanup log unmount handling
Quoted 4 lines · Christoph Hellwig
Kill the current
xfs_log_unmountwrapper and opencode the two function calls in the only caller. Rename the currentxfs_log_unmount_dealloctoxfs_log_unmountas it undoesxfs_log_mountand the new name makes that more clear.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/7 xfs: remove another leftover of the old inode log item format
In reply to Christoph HellwigThere's another little snipplet of code left from the handling of the old inode log item format in xlog_recover_do_inode_trans. Kill it as it can't be reached anymore.
fs/xfs/xfs_log_recover.c +4 -10
@@ -2519,16 +2519,10 @@ xlog_recover_do_inode_trans( } write_inode_buffer: -if (ITEM_TYPE (item) ==XFS_LI_INODE ) { -ASSERT (bp->b_mount ==NULL || bp->b_mount == mp); - bp->b_mount = mp; -XFS_BUF_SET_IODONE_FUNC (bp, xlog_recover_iodone); -xfs_bdwrite (mp, bp); - }else { -XFS_BUF_STALE (bp); - error =xfs_bwrite (mp, bp); - } - +ASSERT (bp->b_mount ==NULL || bp->b_mount == mp); + bp->b_mount = mp; +XFS_BUF_SET_IODONE_FUNC (bp, xlog_recover_iodone); +xfs_bdwrite (mp, bp); error:if (need_free)kmem_free (in_f);
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 2/7] xfs: remove another leftover of the old inode log item format
Quoted 3 lines · Christoph Hellwig
There's another little snipplet of code left from the handling of the old inode log item format in
xlog_recover_do_inode_trans. Kill it as it can't be reached anymore.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/7 xfs: cleanup xlog_recover_do_trans
In reply to Christoph HellwigChange the big if-elsif-else block handling the different item types into a more natural switch, remove assignments in conditionals and remove an out of place comment from centuries ago on IRIX.
fs/xfs/xfs_log_recover.c +31 -34
@@ -2763,51 +2763,48 @@ xlog_recover_do_trans(int error =0 ;xlog_recover_item_t *item, *first_item; -if ((error =xlog_recover_reorder_trans (trans))) + error =xlog_recover_reorder_trans (trans); +if (error)return error; + first_item = item = trans->r_itemq;do { -/* -* we don't need to worry about the block number being -* truncated in > 1 TB buffers because in user-land, -* we're now n32 or 64-bit so xfs_daddr_t is 64-bits so -* the blknos will get through the user-mode buffer -* cache properly. The only bad case is o32 kernels -* where xfs_daddr_t is 32-bits but mount will warn us -* off a > 1 TB filesystem before we get here. -*/ -if ((ITEM_TYPE (item) ==XFS_LI_BUF )) { -if ((error =xlog_recover_do_buffer_trans (log, item, - pass))) -break ; - }else if ((ITEM_TYPE (item) ==XFS_LI_INODE )) { -if ((error =xlog_recover_do_inode_trans (log, item, - pass))) -break ; - }else if (ITEM_TYPE (item) ==XFS_LI_EFI ) { -if ((error =xlog_recover_do_efi_trans (log, item, trans->r_lsn, - pass))) -break ; - }else if (ITEM_TYPE (item) ==XFS_LI_EFD ) { +switch (ITEM_TYPE (item)) { +case XFS_LI_BUF : + error =xlog_recover_do_buffer_trans (log, item, pass); +break ; +case XFS_LI_INODE : + error =xlog_recover_do_inode_trans (log, item, pass); +break ; +case XFS_LI_EFI : + error =xlog_recover_do_efi_trans (log, item, + trans->r_lsn, pass); +break ; +case XFS_LI_EFD :xlog_recover_do_efd_trans (log, item, pass); - }else if (ITEM_TYPE (item) ==XFS_LI_DQUOT ) { -if ((error =xlog_recover_do_dquot_trans (log, item, - pass))) -break ; - }else if ((ITEM_TYPE (item) ==XFS_LI_QUOTAOFF )) { -if ((error =xlog_recover_do_quotaoff_trans (log, item, - pass))) -break ; - }else { -xlog_warn ("XFS: xlog_recover_do_trans" ); + error =0 ; +break ; +case XFS_LI_DQUOT : + error =xlog_recover_do_dquot_trans (log, item, pass); +break ; +case XFS_LI_QUOTAOFF : + error =xlog_recover_do_quotaoff_trans (log, item, + pass); +break ; +default : +xlog_warn ( +"XFS: invalid item type (%d) xlog_recover_do_trans" ,ITEM_TYPE (item));ASSERT (0 ); error =XFS_ERROR (EIO );break ; } + +if (error) +return error; item = item->ri_next; }while (first_item != item); -return error; +return 0 ; }/*
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 3/7] xfs: cleanup xlog_recover_do_trans
Quoted 3 lines · Christoph Hellwig
Change the big if-elsif-else block handling the different item types into a more natural switch, remove assignments in conditionals and remove an out of place comment from centuries ago on IRIX.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 4/7 xfs: cleanup xlog_bread
In reply to Christoph HellwigMost callers of xlog_bread need to call xlog_align to get the actual offset. Consolidate that call into the main xlog_bread and provide a _xlog_bread for those few that don't want the actual offset.
fs/xfs/xfs_log_priv.h +0 -1
@@ -455,7 +455,6 @@ extern void xlog_recover_process_iunlinextern struct xfs_buf *xlog_get_bp (xlog_t *,int );extern void xlog_put_bp (struct xfs_buf *); -extern int xlog_bread (xlog_t *,xfs_daddr_t ,int ,struct xfs_buf *);extern kmem_zone_t *xfs_log_ticket_zone;
fs/xfs/xfs_log_recover.c +137 -87
430 lines not on this page · raw message
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 4/7] xfs: cleanup xlog_bread
Quoted 3 lines · Christoph Hellwig
Most callers of
xlog_breadneed to callxlog_alignto get the actual offset. Consolidate that call into the mainxlog_breadand provide a_xlog_breadfor those few that don't want the actual offset.
Only one leading underscore? IOW, why not not __xlog_bread? (That's definitely more Linux-like.)
Josef 'Jeff' Sipek.
Signature · 6 lines
The box said "Windows XP or better required". So I installed Linux. _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 4/7] xfs: cleanup xlog_bread
Quoted 7 lines · Josef 'Jeff' Sipek
Quoted 3 lines · Christoph Hellwig
Most callers of
xlog_breadneed to callxlog_alignto get the actual offset. Consolidate that call into the mainxlog_breadand provide a_xlog_breadfor those few that don't want the actual offset.Only one leading underscore? IOW, why not not
__xlog_bread? (That's definitely more Linux-like.)
In that deep down xfs code a single underscore is the more common idiom. Of course a descriptive name might be even better :)
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 4/7] xfs: cleanup xlog_bread
In reply to Christoph HellwigQuoted 6 lines · Christoph Hellwig
Most callers of
xlog_breadneed to callxlog_alignto get the actual offset. Consolidate that call into the mainxlog_breadand provide a_xlog_breadfor those few that don't want the actual offset.Signed-off-by Christoph Hellwig <[email protected]>
.....
fs/xfs/xfs_log_recover.c xlog_bread( · line 156
Quoted 12 lines
* nbblks should be uint, but oh well. Just want to catch that 32-bit length. */
fs/xfs/xfs_log_recover.c +2
-2-int -xlog_bread( +STATIC int +_xlog_bread( xlog_t *log, xfs_daddr_t blk_no, int nbblks,@@ -137,6 +155,24 @@ xlog_bread(return error; }
xlog_bread_noalign().
Otherwise looks good. Consider it:
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 5/7 xfs: kill vn_atime_* helpers.
In reply to Christoph HellwigTwo out of three are unused already, and the third is better done open-coded with a comment describing what's going on here.
fs/xfs/linux-2.6/xfs_vnode.h +0 -19
@@ -58,25 +58,6 @@ static inline int VN_BAD(struct inode *v }/* -* Extracting atime values in various formats -*/ -static inline void vn_atime_to_bstime (struct inode *vp,xfs_bstime_t *bs_atime) -{ - bs_atime->tv_sec = vp->i_atime.tv_sec; - bs_atime->tv_nsec = vp->i_atime.tv_nsec; -} - -static inline void vn_atime_to_timespec (struct inode *vp,struct timespec *ts) -{ - *ts = vp->i_atime; -} - -static inline void vn_atime_to_time_t (struct inode *vp,time_t *tt) -{ - *tt = vp->i_atime.tv_sec; -} - -/* * Some useful predicates. */ #define VN_MAPPED (vp) mapping_mapped(vp->i_mapping)
fs/xfs/xfs_itable.c +6 -1
@@ -83,7 +83,12 @@ xfs_bulkstat_one_iget( buf->bs_uid = dic->di_uid; buf->bs_gid = dic->di_gid; buf->bs_size = dic->di_size; -vn_atime_to_bstime (VFS_I (ip), &buf->bs_atime); +/* +* We are reading the atime from the Linux inode because the +* dinode might not be uptodate. +*/ + buf->bs_atime.tv_sec =VFS_I (ip)->i_atime.tv_sec; + buf->bs_atime.tv_nsec =VFS_I (ip)->i_atime.tv_nsec; buf->bs_mtime.tv_sec = dic->di_mtime.t_sec; buf->bs_mtime.tv_nsec = dic->di_mtime.t_nsec; buf->bs_ctime.tv_sec = dic->di_ctime.t_sec;
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 5/7] xfs: kill vn_atime_* helpers.
Quoted 2 lines · Christoph Hellwig
Two out of three are unused already, and the third is better done open-coded with a comment describing what's going on here.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 6/7 xfs: kill VN_BAD
In reply to Christoph HellwigRemove this rather pointless wrapper and use is_bad_inode directly.
fs/xfs/linux-2.6/xfs_vnode.h +0 -8
@@ -50,14 +50,6 @@ struct attrlist_cursor_kern;the operation completes. */ /* -* Dealing with bad inodes -*/ -static inline int VN_BAD (struct inode *vp) -{ -return is_bad_inode (vp); -} - -/* * Some useful predicates. */ #define VN_MAPPED (vp) mapping_mapped(vp->i_mapping)
fs/xfs/xfs_vnodeops.c +2 -2
@@ -1136,7 +1136,7 @@ xfs_inactive(* If the inode is already free, then there can be nothing * to clean up here. */ -if (ip->i_d.di_mode ==0 ||VN_BAD (VFS_I (ip))) { +if (ip->i_d.di_mode ==0 ||is_bad_inode (VFS_I (ip))) {ASSERT (ip->i_df.if_real_bytes ==0 );ASSERT (ip->i_df.if_broot_bytes ==0 );return VN_INACTIVE_CACHE ;
@@ -2448,7 +2448,7 @@ xfs_reclaim(ASSERT (!VN_MAPPED (VFS_I (ip)));/* bad inode, get out here ASAP */ -if (VN_BAD (VFS_I (ip))) { +if (is_bad_inode (VFS_I (ip))) {xfs_ireclaim (ip);return 0 ; }
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 6/7] xfs: kill VN_BAD
Quoted 1 line · Christoph Hellwig
Remove this rather pointless wrapper and use
is_bad_inodedirectly.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 7/7 xfs: factor out code to find the longest free extent in the AG
In reply to Christoph HellwigFrom: Dave Chinner <[email protected]>
fs/xfs/xfs_alloc.c +21 -5
@@ -1872,6 +1872,25 @@ xfs_alloc_compute_maxlevels( }/* +* Find the length of the longest extent in an AG. +*/ +xfs_extlen_t +xfs_alloc_min_freelist ( +struct xfs_mount *mp, +struct xfs_perag *pag) +{ +xfs_extlen_t need, delta =0 ; + + need =XFS_MIN_FREELIST_PAG (pag, mp); +if (need > pag->pagf_flcount) + delta = need - pag->pagf_flcount; + +if (pag->pagf_longest > delta) +return pag->pagf_longest - delta; +return pag->pagf_flcount >0 || pag->pagf_longest >0 ; +} + +/* * Decide whether to use this allocation group for this allocation. * If so, fix up the btree freelist's size. */
@@ -1923,15 +1942,12 @@ xfs_alloc_fix_freelist( }if (!(flags &XFS_ALLOC_FLAG_FREEING )) { - need =XFS_MIN_FREELIST_PAG (pag, mp); - delta = need > pag->pagf_flcount ? need - pag->pagf_flcount :0 ;/* * If it looks like there isn't a long enough extent, or enough * total blocks, reject it. */ - longest = (pag->pagf_longest > delta) ? - (pag->pagf_longest - delta) : - (pag->pagf_flcount >0 || pag->pagf_longest >0 ); + need =XFS_MIN_FREELIST_PAG (pag, mp); + longest =xfs_alloc_min_freelist (mp, pag); if ((args->minlen + args->alignment + args->minalignslop - 1) > longest || ((int)(pag->pagf_freeblks + pag->pagf_flcount -
fs/xfs/xfs_alloc.h +6 -0
@@ -100,6 +100,12 @@ typedef struct xfs_alloc_arg {#define XFS_ALLOC_USERDATA 1/* allocation is for user data*/ #define XFS_ALLOC_INITIAL_USER_DATA 2/* special case start of file */ +/* +* Find the length of the longest extent in an AG. +*/ +xfs_extlen_t +xfs_alloc_min_freelist (struct xfs_mount *mp, +struct xfs_perag *pag);#ifdef __KERNEL__
fs/xfs/xfs_bmap.c +2 -10
@@ -2712,9 +2712,6 @@ xfs_bmap_btalloc(xfs_agnumber_t startag;xfs_alloc_arg_t args;xfs_extlen_t blen; -xfs_extlen_t delta; -xfs_extlen_t longest; -xfs_extlen_t need;xfs_extlen_t nextminlen =0 ;xfs_perag_t *pag;int nullfb;/* true if ap->firstblock isn't set */
@@ -2796,13 +2793,8 @@ xfs_bmap_btalloc(* See xfs_alloc_fix_freelist... */ if (pag->pagf_init) { - need =XFS_MIN_FREELIST_PAG (pag, mp); - delta = need > pag->pagf_flcount ? - need - pag->pagf_flcount :0 ; - longest = (pag->pagf_longest > delta) ? - (pag->pagf_longest - delta) : - (pag->pagf_flcount >0 || - pag->pagf_longest >0 ); +xfs_extlen_t longest; + longest =xfs_alloc_min_freelist (mp, pag);if (blen < longest) blen = longest; }else
fs/xfs/xfs_filestream.c +2 -7
@@ -140,7 +140,7 @@ _xfs_filestream_pick_ag( xfs_extlen_t minlen) {int err, trylock, nscan; -xfs_extlen_t delta, longest, need, free, minfree, maxfree =0 ; +xfs_extlen_t longest, free, minfree, maxfree =0 ;xfs_agnumber_t ag, max_ag =NULLAGNUMBER ;struct xfs_perag *pag;
@@ -186,12 +186,7 @@ _xfs_filestream_pick_ag( goto next_ag; } - need =XFS_MIN_FREELIST_PAG (pag, mp); - delta = need > pag->pagf_flcount ? need - pag->pagf_flcount :0 ; - longest = (pag->pagf_longest > delta) ? - (pag->pagf_longest - delta) : - (pag->pagf_flcount >0 || pag->pagf_longest >0 ); - + longest =xfs_alloc_min_freelist (mp, pag); if (((minlen && longest >= minlen) || (!minlen && pag->pagf_freeblks >= minfree)) && (!pag->pagf_metadata || !(flags & XFS_PICK_USERDATA) ||
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 7/7] xfs: factor out code to find the longest free extent in the AG
Quoted 3 lines · Christoph Hellwig
From: Dave Chinner <[email protected]>
Signed-off-by Dave Chinner <[email protected]>
....
fs/xfs/xfs_alloc.c xfs_alloc_compute_maxlevels( · line 1880
Quoted 7 lines
/*
+ * Find the length of the longest extent in an AG.
+ */fs/xfs/xfs_alloc.c +4
-0+xfs_extlen_t +xfs_alloc_min_freelist ( +struct xfs_mount *mp, +struct xfs_perag *pag)
Looking at this again, I'd change the name of this function to xfs_alloc_ag_longest_free_extent(), because that is what it is actually returning....
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 7/7] xfs: factor out code to find the longest free extent in the AG
Quoted 4 lines · Dave Chinner
Looking at this again, I'd change the name of this function to
xfs_alloc_ag_longest_free_extent(), because that is what it is actually returning....
I've left the _ag out and made it xfs_alloc_longest_free_extent. The ag is kinda implicit by the perag argument..
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
All patches are now available to pull from
git://git.kernel.org/pub/scm/fs/xfs/xfs.git
with the minor review comments from Dave incorporated.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 3 lines · Christoph Hellwig
All patches are now available to pull from
git://git.kernel.org/pub/scm/fs/xfs/xfs.git
I pushed them to oss this morning.
Felix
Quoted 8 lines
with the minor review comments from Dave incorporated.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs