From: David Sterba <dsterba@suse.cz>
To: Liu Bo <bo.li.liu@oracle.com>
Cc: linux-btrfs@vger.kernel.org, jeff.liu@oracle.com
Subject: Re: [PATCH v2] Btrfs: export btrfs space shared info to userspace
Date: Mon, 16 Sep 2013 10:55:17 +0200 [thread overview]
Message-ID: <20130916085517.GQ6810@suse.cz> (raw)
In-Reply-To: <1379319504-20941-1-git-send-email-bo.li.liu@oracle.com>
On Mon, Sep 16, 2013 at 04:18:24PM +0800, Liu Bo wrote:
> @@ -4122,7 +4136,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
> last = found_key.offset;
> last_for_get_extent = last + 1;
> }
> - btrfs_free_path(path);
> + btrfs_release_path(path);
>
> /*
> * we might have some extents allocated but more delalloc past those
> @@ -4192,7 +4206,24 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
> flags |= (FIEMAP_EXTENT_DELALLOC |
> FIEMAP_EXTENT_UNKNOWN);
> } else {
> + unsigned long ref_cnt = 0;
> +
> disko = em->block_start + offset_in_extent;
> +
> + /*
> + * As btrfs supports shared space, this information
> + * can be exported to userspace tools via
> + * flag FIEMAP_EXTENT_SHARED.
> + */
> + ret = iterate_inodes_from_logical(
> + em->block_start,
> + BTRFS_I(inode)->root->fs_info,
> + path, count_ext_ref, &ref_cnt);
> + if (ret < 0)
> + goto out_free;
> +
> + if (ref_cnt > 1)
> + flags |= FIEMAP_EXTENT_SHARED;
> }
> if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags))
> flags |= FIEMAP_EXTENT_ENCODED;
> @@ -4226,6 +4257,7 @@ out_free:
> out:
> unlock_extent_cached(&BTRFS_I(inode)->io_tree, start, start + len - 1,
> &cached_state, GFP_NOFS);
> + btrfs_free_path(path);
I think this free_path should go before unlock_extent_cached, it's not
needed for unlock_extent_cached itself and will delay unlocking the
path unnecessarily (it's set to leave_spinning = 1).
> return ret;
> }
next prev parent reply other threads:[~2013-09-16 8:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-16 8:18 [PATCH v2] Btrfs: export btrfs space shared info to userspace Liu Bo
2013-09-16 8:55 ` David Sterba [this message]
2013-09-16 9:28 ` Liu Bo
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=20130916085517.GQ6810@suse.cz \
--to=dsterba@suse.cz \
--cc=bo.li.liu@oracle.com \
--cc=jeff.liu@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).