[Top] [All Lists]

Re: [PATCH 12/12] xfs: Remove the macro XFS_BUFTARG_NAME

To: Chandra Seetharaman <sekharan@xxxxxxxxxx>
Subject: Re: [PATCH 12/12] xfs: Remove the macro XFS_BUFTARG_NAME
From: Alex Elder <aelder@xxxxxxx>
Date: Fri, 22 Jul 2011 14:49:41 -0500
Cc: <xfs@xxxxxxxxxxx>
In-reply-to: <20110722003408.21069.44409.sendpatchset@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <20110722003226.21069.58401.sendpatchset@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20110722003408.21069.44409.sendpatchset@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Reply-to: <aelder@xxxxxxx>
On Thu, 2011-07-21 at 17:34 -0700, Chandra Seetharaman wrote:
> Remove the definition and usages of the macro XFS_BUFTARG_NAME.
> Signed-off-by: Chandra Seetharaman <sekharan@xxxxxxxxxx>
> Reviewed-by: Christoph Hellwig <hch@xxxxxx>

Wow, I hadn't looked at the definition of
xfs_buf_target_name() before.  It's not safe
(using a pointer to since-released stack space),
though in practice it's going to be fine.

Defining it as an inline function with a static
buffer would at least avoid that, though it
means it's not reentrant either.

I would personally prefer doing it that way though.

/* NB: returns pointer to buffer reused on each call */
static inline char *
xfs_buf_target_name(struct xfs_buftarg *target)
        static char __b[BDEVNAME_SIZE];

        return bdevname(target->bt_bdev, __b);

Anyway, you didn't change this, but you're touching
the code that uses it.  So unless others object I
would like to see this changed along with the
rest of what you do here (which is all good, by
the way).

Either way:

Reviewed-by: Alex Elder <aelder@xxxxxxx>

<Prev in Thread] Current Thread [Next in Thread>