All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Tinguely <tinguely@sgi.com>
To: Ben Myers <bpm@sgi.com>
Cc: Christoph Hellwig <hch@infradead.org>, xfs@oss.sgi.com
Subject: Re: [PATCH 04/11] xfs: remove the if_ext_max field in struct	xfs_ifork
Date: Tue, 17 Jan 2012 11:04:44 -0600	[thread overview]
Message-ID: <4F15AA2C.5070506@sgi.com> (raw)
In-Reply-To: <20120117151639.GE16581@sgi.com>

On 01/17/12 09:16, Ben Myers wrote:
> On Mon, Jan 16, 2012 at 04:45:27PM -0600, Ben Myers wrote:
>> Hey Christoph,
>>
>> On Fri, Jan 06, 2012 at 10:58:18AM -0600, Ben Myers wrote:
>>> On Sun, Dec 18, 2011 at 03:00:07PM -0500, Christoph Hellwig wrote:
>>>> We spent a lot of effort to maintain this field, but it always equalts to the
>>> 								equals the
>>>> fork size divided by the constant size of an extent.  The prime use of it is
>>>> to assert that the two stay in sync.  Just divide the fork size by the extent
>>>> size in the few places that we actually use it and remove the overhead
>>>> of maintaining it.  Also introduce a few helpers to consolidate the places
>>>> where we actually care about the value.
>>>>
>>>> Signed-off-by: Christoph Hellwig<hch@lst.de>
>>>> Reviewed-by: Dave Chinner<dchinner@redhat.com>
>>>
>>> After reviewing this patch it's not crystal clear to me why we were
>>> putting all that effort into keeping this counter uptodate on the inode
>>> instead of using helpers like you've implemented.  Maybe a question of
>>> integer division as Dave suggested.  This is a nice improvement.
>>>
>>>> Index: xfs/fs/xfs/xfs_bmap.c
>>>> ===================================================================
>>>> --- xfs.orig/fs/xfs/xfs_bmap.c	2011-12-12 10:33:55.748696870 -0800
>>>> +++ xfs/fs/xfs/xfs_bmap.c	2011-12-14 05:15:20.612373687 -0800
>>>> @@ -249,7 +249,27 @@ xfs_bmbt_lookup_ge(
>>>>   }
>>>>
>>>>   /*
>>>> -* Update the record referred to by cur to the value given
>>>> + * Check if the inode needs to be converted to btree format.
>>>> + */
>>>> +static inline bool xfs_bmap_needs_btree(struct xfs_inode *ip, int whichfork)
>>>> +{
>>>> +	return XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_EXTENTS&&
>>>> +		XFS_IFORK_NEXTENTS(ip, whichfork)>
>>>> +			XFS_IFORK_MAXEXT(ip, whichfork);
>>>> +}
>>>> +
>>>> +/*
>>>> + * Check if the inode should be converted to extent format.
>>>> + */
>>>> +static inline bool xfs_bmap_wants_extents(struct xfs_inode *ip, int whichfork)
>>>> +{
>>>> +	return XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE&&
>>>> +		XFS_IFORK_NEXTENTS(ip, whichfork)<=
>>>> +			XFS_IFORK_MAXEXT(ip, whichfork);
>>>> +}
>>>
>>> The logic in these two appears to be equivalent to the code you've
>>> replaced in all but one case...
>>>


I am coming late into this review party, and I know this is time 
sensitive. I am looking at this from the big picture and you can ignore me.

Looking at the INTENTION of the tests, IMO, we are asking: "is it time 
to change format?" IMO, you do not want to flip between format without 
data count change - in other words, the two tests should NOT overlap.

/*
  * Check if the inode should be converted to extent format.
  */
static inline bool xfs_bmap_wants_extents(struct xfs_inode *ip, int 
whichfork)
{
	return XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE &&
-		XFS_IFORK_NEXTENTS(ip, whichfork) <=
+		XFS_IFORK_NEXTENTS(ip, whichfork) <  /* less */
			XFS_IFORK_MAXEXT(ip, whichfork);
}


>>> ...
>>>
>>>> @@ -5321,8 +5318,7 @@ xfs_bunmapi(
>>>>   		 * will be dirty.
>>>>   		 */
>>>>   		if (!wasdel&&  xfs_trans_get_block_res(tp) == 0&&
>>>> -		    XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_EXTENTS&&
>>>> -		    XFS_IFORK_NEXTENTS(ip, whichfork)>= ifp->if_ext_max&&
>>> 						^^
>>> All other tests for this were:
>>> XFS_IFORK_NEXTENTS(ip, whichfork)>  ifp->if_ext_max
>>>
>>> Did you just fix a lurking off-by-one or insert one?
>>>
>>> xfs_bmap_needs_btree needs ip->i_d.di_nextents to have been incremented
>>> already in order to detect that we need to convert to btree format.  In
>>> this case we haven't done that yet and are checking to see if doing so
>>> would require conversion to btree format...
>>>
>>> Looks to me like we can't use xfs_bmap_needs_btree here and should use
>>> the old logic.  Right?
>>
>> HCH, I have a question for you here that I feel needs to be resolved.
>> Can you take a look?
>
> Here is what I propose to use here:
>
> @@ -5322,7 +5319,8 @@ xfs_bunmapi(
>                   */
>                  if (!wasdel&&  xfs_trans_get_block_res(tp) == 0&&
>                      XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_EXTENTS&&
> -                   XFS_IFORK_NEXTENTS(ip, whichfork)>= ifp->if_ext_max&&
> +                   XFS_IFORK_NEXTENTS(ip, whichfork)>= /* Note the>= */
> +                       XFS_IFORK_MAXEXT(ip, whichfork)&&
>                      del.br_startoff>  got.br_startoff&&
>                      del.br_startoff + del.br_blockcount<
>                      got.br_startoff + got.br_blockcount) {
>
> -Ben


The original "XFS_IFORK_NEXTENTS(ip, whichfork)>= ifp->if_ext_max" is 
important because the removal of the blocks in xfs_bmap_del_extent() 
will create a hole that requires an insertion.


--Mark Tinguely
   tinguely@sgi.com


--Mark Tinguely.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2012-01-17 17:04 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-18 20:00 [PATCH 00/11] inode shrink and misc updates V2 Christoph Hellwig
2011-12-18 20:00 ` [PATCH 01/11] xfs: remove xfs_itruncate_data Christoph Hellwig
2012-01-03 21:53   ` Ben Myers
2012-01-04  9:27     ` Christoph Hellwig
2011-12-18 20:00 ` [PATCH 02/11] xfs: cleanup xfs_iomap_eof_align_last_fsb Christoph Hellwig
2012-01-04 20:32   ` Ben Myers
2011-12-18 20:00 ` [PATCH 03/11] xfs: remove the unused dm_attrs structure Christoph Hellwig
2012-01-04 21:13   ` Ben Myers
2011-12-18 20:00 ` [PATCH 04/11] xfs: remove the if_ext_max field in struct xfs_ifork Christoph Hellwig
2012-01-06 16:58   ` Ben Myers
2012-01-16 22:45     ` Ben Myers
2012-01-17 15:16       ` Ben Myers
2012-01-17 17:04         ` Mark Tinguely [this message]
2011-12-18 20:00 ` [PATCH 05/11] xfs: make i_flags an unsigned long Christoph Hellwig
2011-12-18 20:00 ` [PATCH 06/11] xfs: replace i_flock with a sleeping bitlock Christoph Hellwig
2012-01-13 21:49   ` Ben Myers
2011-12-18 20:00 ` [PATCH 07/11] xfs: replace i_pin_wait with a bit waitqueue Christoph Hellwig
2012-01-13 22:42   ` Ben Myers
2011-12-18 20:00 ` [PATCH 08/11] xfs: remove the i_size field in struct xfs_inode Christoph Hellwig
2012-01-16 18:32   ` Ben Myers
2012-01-16 19:45     ` Ben Myers
2011-12-18 20:00 ` [PATCH 09/11] xfs: remove the i_new_size " Christoph Hellwig
2011-12-18 22:13   ` Dave Chinner
2012-01-16 22:41   ` Ben Myers
2012-01-17 20:14   ` Ben Myers
2011-12-18 20:00 ` [PATCH 10/11] xfs: always return with the iolock held from xfs_file_aio_write_checks Christoph Hellwig
2012-01-17 20:18   ` Ben Myers
2012-01-20 12:51     ` Jeff Liu
2011-12-18 20:00 ` [PATCH 11/11] xfs: cleanup xfs_file_aio_write Christoph Hellwig
2012-01-17 20:42   ` Ben Myers
  -- strict thread matches above, loose matches on Subject: below --
2011-12-08 15:57 [PATCH 00/11] inode shrink and misc updates Christoph Hellwig
2011-12-08 15:57 ` [PATCH 04/11] xfs: remove the if_ext_max field in struct xfs_ifork Christoph Hellwig
2011-12-13 21:59   ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F15AA2C.5070506@sgi.com \
    --to=tinguely@sgi.com \
    --cc=bpm@sgi.com \
    --cc=hch@infradead.org \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.