Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1555146

Re: [PATCH 07/12 linux-next] udf: store allocation offset in udf_prealloc_extents()

From Jan Kara <jack@suse.cz>
Newsgroups linux.kernel
Subject Re: [PATCH 07/12 linux-next] udf: store allocation offset in udf_prealloc_extents()
Date 2017-01-10 12:00 +0100
Message-ID <sY2jL-he-11@gated-at.bofh.it> (permalink)
References <sWJMd-7eR-3@gated-at.bofh.it> <sWJMe-7eR-49@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri 06-01-17 21:53:55, Fabian Frederick wrote:
> recalculate offset if needed.
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

IMHO not really worth it since numalloc gets updated and forgetting to
update the byte variant is just too easy. Skipped.

								Honza

> ---
>  fs/udf/inode.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/fs/udf/inode.c b/fs/udf/inode.c
> index f563e97..66514ad 100644
> --- a/fs/udf/inode.c
> +++ b/fs/udf/inode.c
> @@ -998,10 +998,10 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
>  				length : UDF_DEFAULT_PREALLOC_BLOCKS) -
>  				currlength);
>  		if (numalloc) 	{
> +			loff_t pos = numalloc << inode->i_sb->s_blocksize_bits;
> +
>  			if (start == (c + 1))
> -				laarr[start].extLength +=
> -					(numalloc <<
> -					 inode->i_sb->s_blocksize_bits);
> +				laarr[start].extLength += pos;
>  			else {
>  				memmove(&laarr[c + 2], &laarr[c + 1],
>  					sizeof(struct long_ad) * (*endnum - (c + 1)));
> @@ -1011,9 +1011,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
>  					laarr[c].extLocation.
>  							partitionReferenceNum;
>  				laarr[c + 1].extLength =
> -					EXT_NOT_RECORDED_ALLOCATED |
> -					(numalloc <<
> -					 inode->i_sb->s_blocksize_bits);
> +					EXT_NOT_RECORDED_ALLOCATED | pos;
>  				start = c + 1;
>  			}
>  
> @@ -1024,12 +1022,12 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
>  					    inode->i_sb->s_blocksize_bits;
>  
>  				if (elen > numalloc) {
> -					laarr[i].extLength -=
> -						(numalloc <<
> -						 inode->i_sb->s_blocksize_bits);
> -					numalloc = 0;
> +					laarr[i].extLength -= pos;
> +					numalloc = pos = 0;
>  				} else {
>  					numalloc -= elen;
> +					pos = numalloc <<
> +					      inode->i_sb->s_blocksize_bits;
>  					if (*endnum > (i + 1))
>  						memmove(&laarr[i],
>  							&laarr[i + 1],
> @@ -1039,8 +1037,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
>  					(*endnum)--;
>  				}
>  			}
> -			UDF_I(inode)->i_lenExtents +=
> -				numalloc << inode->i_sb->s_blocksize_bits;
> +			UDF_I(inode)->i_lenExtents += pos;
>  		}
>  	}
>  }
> -- 
> 2.7.4
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/12 linux-next] udf: clean-up Fabian Frederick <fabf@skynet.be> - 2017-01-06 22:00 +0100
  [PATCH 09/12 linux-next] udf: merge module informations in super.c Fabian Frederick <fabf@skynet.be> - 2017-01-06 22:00 +0100
    Re: [PATCH 09/12 linux-next] udf: merge module informations in  super.c Jan Kara <jack@suse.cz> - 2017-01-10 12:00 +0100
  [PATCH 04/12 linux-next] udf: remove unneeded line break Fabian Frederick <fabf@skynet.be> - 2017-01-06 22:00 +0100
    Re: [PATCH 04/12 linux-next] udf: remove unneeded line break Jan Kara <jack@suse.cz> - 2017-01-10 11:40 +0100
  [PATCH 05/12 linux-next] udf: remove empty condition Fabian Frederick <fabf@skynet.be> - 2017-01-06 22:00 +0100
    Re: [PATCH 05/12 linux-next] udf: remove empty condition Jan Kara <jack@suse.cz> - 2017-01-10 11:40 +0100
  [PATCH 08/12 linux-next] udf: remove next_epos from udf_update_extent_cache() Fabian Frederick <fabf@skynet.be> - 2017-01-06 22:00 +0100
    Re: [PATCH 08/12 linux-next] udf: remove next_epos from  udf_update_extent_cache() Jan Kara <jack@suse.cz> - 2017-01-10 12:00 +0100
  [PATCH 01/12 linux-next] udf: use __packed instead of __attribute__ ((packed)) Fabian Frederick <fabf@skynet.be> - 2017-01-06 22:00 +0100
    Re: [PATCH 01/12 linux-next] udf: use __packed instead of  __attribute__ ((packed)) Jan Kara <jack@suse.cz> - 2017-01-10 11:40 +0100
  [PATCH 02/12 linux-next] udf: use pointer for kernel_long_ad argument Fabian Frederick <fabf@skynet.be> - 2017-01-06 22:00 +0100
    Re: [PATCH 02/12 linux-next] udf: use pointer for kernel_long_ad  argument Jan Kara <jack@suse.cz> - 2017-01-10 11:40 +0100
  [PATCH 10/12 linux-next] udf: atomically read inode size Fabian Frederick <fabf@skynet.be> - 2017-01-06 22:00 +0100
    [PATCH 11/12 linux-next] udf: replace 0xFFFFFFFF by ~0 Fabian Frederick <fabf@skynet.be> - 2017-01-06 22:00 +0100
    Re: [PATCH 10/12 linux-next] udf: atomically read inode size Jan Kara <jack@suse.cz> - 2017-01-10 12:00 +0100
  [PATCH 07/12 linux-next] udf: store allocation offset in udf_prealloc_extents() Fabian Frederick <fabf@skynet.be> - 2017-01-06 22:00 +0100
    Re: [PATCH 07/12 linux-next] udf: store allocation offset in  udf_prealloc_extents() Jan Kara <jack@suse.cz> - 2017-01-10 12:00 +0100
  Re: [PATCH 00/12 linux-next] udf: clean-up Jan Kara <jack@suse.cz> - 2017-01-10 12:10 +0100

csiph-web