[systemd-devel] [PATCH 5/6] readahead-collect: handle btrfs FIEMAP

Lennart Poettering lennart at poettering.net
Sun Sep 26 17:03:35 PDT 2010


On Fri, 24.09.10 12:06, harald at redhat.com (harald at redhat.com) wrote:

> From: Harald Hoyer <harald at redhat.com>
> 
> Some files on btrfs do not have a physical extent. Just return an
> increasing number.

Hmm, why an increasing number? Care to elaborate?

> ---
>  src/readahead-collect.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/src/readahead-collect.c b/src/readahead-collect.c
> index 7983b31..f7f0f14 100644
> --- a/src/readahead-collect.c
> +++ b/src/readahead-collect.c
> @@ -146,6 +146,7 @@ static unsigned long fd_first_block(int fd) {
>                  struct fiemap fiemap;
>                  struct fiemap_extent extent;
>          } data;
> +	static unsigned long ul = 0;
>  
>          zero(data);
>          data.fiemap.fm_length = ~0ULL;
> @@ -160,6 +161,12 @@ static unsigned long fd_first_block(int fd) {
>          if (data.fiemap.fm_extents[0].fe_flags & FIEMAP_EXTENT_UNKNOWN)
>                  return 0;
>  
> +	// Some filesystems/files do not have a physical extent.
> +	// Just return an increasing number.

And a nitpick:

Hey, this is C, not C++. 

/* this is nice */
// this not so much.

(yes, systemd is C99, but we only use the nice feature additions of it,
not the evil ones...)

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list