You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Bert Huijben <be...@qqmail.nl> on 2013/02/14 13:13:52 UTC

RE: svn commit: r1446113 - /subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c


> -----Original Message-----
> From: stefan2@apache.org [mailto:stefan2@apache.org]
> Sent: donderdag 14 februari 2013 11:58
> To: commits@subversion.apache.org
> Subject: svn commit: r1446113 - /subversion/branches/fsfs-
> format7/subversion/libsvn_fs_fs/index.c
> 
> Author: stefan2
> Date: Thu Feb 14 10:58:15 2013
> New Revision: 1446113
> 
> URL: http://svn.apache.org/r1446113
> Log:
> On the fsfs-format7 branch:  Prevent the packed number stream from
> prefetching across block boundaries.
> 
> * subversion/libsvn_fs_fs/index.c
>   (stream_error_create): new error construction utility
>   (packed_stream_read): limit the prefetch close to block boundaries
> 
> Modified:
>     subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c
> 
> Modified: subversion/branches/fsfs-
> format7/subversion/libsvn_fs_fs/index.c
> URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-
> format7/subversion/libsvn_fs_fs/index.c?rev=1446113&r1=1446112&r2=144
> 6113&view=diff
> ==========================================================
> ====================
> --- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c
> (original)
> +++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c Thu
> Feb 14 10:58:15 2013
> @@ -170,6 +170,23 @@ typedef struct packed_number_stream_t
>    value_position_pair_t buffer[MAX_NUMBER_PREFETCH];
>  } packed_number_stream_t;
> 
> +/* Return an svn_error_t * object for error ERR on STREAM with the given
> + * MESSAGE string.  The latter must have a placeholder for the index file
> + * name ("%s") and the current read offset (e.g. "%lx").
> + */
> +static svn_error_t *
> +stream_error_create(packed_number_stream_t *stream,
> +                    apr_status_t err,
> +                    const char *message)
> +{
> +  const char *file_name;
> +  apr_off_t offset = 0;
> +  SVN_ERR(svn_io_file_name_get(&file_name, stream->file,
> +                               stream->pool));
> +  SVN_ERR(svn_io_file_seek(stream->file, SEEK_CUR, &offset, stream-
> >pool));
> +  return svn_error_createf(err, NULL, message, file_name, offset);
> +}

%lx handles 32 bit on Windows x86 and x64 as long is 32 bit there, while apr_off_t is 64 bit on these platforms.
(Or is this special cased in apr or svn?)

And I would recommend using 0x%<something> to make it obvious for readers of the message that the value is hexadecimal, without having to check the sourcecode.

	Bert


Re: svn commit: r1446113 - /subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c

Posted by Stefan Fuhrmann <st...@wandisco.com>.
On Thu, Feb 14, 2013 at 1:13 PM, Bert Huijben <be...@qqmail.nl> wrote:

>
>
> > -----Original Message-----
> > From: stefan2@apache.org [mailto:stefan2@apache.org]
> > Sent: donderdag 14 februari 2013 11:58
> > To: commits@subversion.apache.org
> > Subject: svn commit: r1446113 - /subversion/branches/fsfs-
> > format7/subversion/libsvn_fs_fs/index.c
> >
> > Author: stefan2
> > Date: Thu Feb 14 10:58:15 2013
> > New Revision: 1446113
> >
> > URL: http://svn.apache.org/r1446113
> > Log:
> > On the fsfs-format7 branch:  Prevent the packed number stream from
> > prefetching across block boundaries.
> >
> > * subversion/libsvn_fs_fs/index.c
> >   (stream_error_create): new error construction utility
> >   (packed_stream_read): limit the prefetch close to block boundaries
> >
> > Modified:
> >     subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c
> >
> > Modified: subversion/branches/fsfs-
> > format7/subversion/libsvn_fs_fs/index.c
> > URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-
> > format7/subversion/libsvn_fs_fs/index.c?rev=1446113&r1=1446112&r2=144
> > 6113&view=diff
> > ==========================================================
> > ====================
> > --- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c
> > (original)
> > +++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/index.c Thu
> > Feb 14 10:58:15 2013
> > @@ -170,6 +170,23 @@ typedef struct packed_number_stream_t
> >    value_position_pair_t buffer[MAX_NUMBER_PREFETCH];
> >  } packed_number_stream_t;
> >
> > +/* Return an svn_error_t * object for error ERR on STREAM with the given
> > + * MESSAGE string.  The latter must have a placeholder for the index
> file
> > + * name ("%s") and the current read offset (e.g. "%lx").
> > + */
> > +static svn_error_t *
> > +stream_error_create(packed_number_stream_t *stream,
> > +                    apr_status_t err,
> > +                    const char *message)
> > +{
> > +  const char *file_name;
> > +  apr_off_t offset = 0;
> > +  SVN_ERR(svn_io_file_name_get(&file_name, stream->file,
> > +                               stream->pool));
> > +  SVN_ERR(svn_io_file_seek(stream->file, SEEK_CUR, &offset, stream-
> > >pool));
> > +  return svn_error_createf(err, NULL, message, file_name, offset);
> > +}
>
> %lx handles 32 bit on Windows x86 and x64 as long is 32 bit there, while
> apr_off_t is 64 bit on these platforms.
> (Or is this special cased in apr or svn?)
>
> And I would recommend using 0x%<something> to make it obvious for readers
> of the message that the value is hexadecimal, without having to check the
> sourcecode.
>

Fixed in r1446377.

Thanks for the review!

-- Stefan^2.

-- 
Certified & Supported Apache Subversion Downloads:
*

http://www.wandisco.com/subversion/download
*