xfs
[Top] [All Lists]

Re: [PATCH 03/14] xfs: convert log grant heads to LSN notation

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 03/14] xfs: convert log grant heads to LSN notation
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Wed, 1 Dec 2010 08:05:04 -0500
Cc: xfs@xxxxxxxxxxx
In-reply-to: <1290994712-21376-4-git-send-email-david@xxxxxxxxxxxxx>
References: <1290994712-21376-1-git-send-email-david@xxxxxxxxxxxxx> <1290994712-21376-4-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
> -STATIC int    xlog_space_left(xlog_t *log, int cycle, int bytes);
> +STATIC int    xlog_space_left(int logsize, xfs_lsn_t tail_lsn,
> +                             xfs_lsn_t head);

Looking further through the series I have to say I really hate
passing in the logsize instead of the log structure.  Passing the
log pointer from higher level functions just makes a lot more sense.

Also in this case passing the tail_lsn explicitly doesn't make any sense
- it becomes atomic later and thus there is no locking requirement for
it.

> -xlog_grant_sub_space(struct log *log, int bytes)
> +__xlog_grant_sub_space(
> +     xfs_lsn_t       *head,
> +     int             bytes,
> +     int             logsize)

Same thing here - the calling convention would be a lot more regular
by still passing the log as first argument.

After the factoring I also think we could cut down on the amount of
wrappers in this area.  Just rename __xlog_grant_sub_space and
__xlog_grant_add_space to not have the __ prefix, and kill the wrappers
around it - they only have one or two callers, and just having two
helpers and passing the heads we're interested in is a lot simpler and
cleaner.

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