xfs
[Top] [All Lists]

[PATCH] xfs: reduce stack usage in xfs_page_state_convert()

To: David Chinner <dgc@xxxxxxx>
Subject: [PATCH] xfs: reduce stack usage in xfs_page_state_convert()
From: Denys Vlasenko <vda.linux@xxxxxxxxxxxxxx>
Date: Sun, 27 Apr 2008 02:46:58 +0200
Cc: xfs@xxxxxxxxxxx, Eric Sandeen <sandeen@xxxxxxxxxxx>, Adrian Bunk <bunk@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date:user-agent:cc:mime-version:content-type:message-id; bh=OEZQot+dsFn1pogSlVhALsq3bq1N7WLB1P0Vw1DCYdg=; b=jsGG4ftuxvQFlQTkf4W5q17gyV5eWhOLj1GMoPdS4g8vwKDNEhcT+qzpCHr//YDfN9b0pansEuNLA9sClRYcw+oHzVQehi5iy6AIEsT9new+RIfQcxAr5W89DBMt8OtX2LzJuPNEbAxlEohzSYRe6E9IxZOdvkUC2GUqGf+tugw=
Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:subject:date:user-agent:cc:mime-version:content-type:message-id; b=FlG5HVShux3qXUaNlol0k21xKxQQQFtbNDNLwnKSRYkC6HhnYdiL0f/q07+ZkEMavXrBIL1Wxsyx6yaeY4rNh77QcA5aaubRmjycIBEuzHRo0ZLBa+s95okn4LsQrMZ/Pc/MJc9U06SkMAvOkrcEqXIhZJg4h1y0DG2KZgAEnNc=
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: KMail/1.8.2
Hi David,

This patch reduces xfs_page_state_convert() stack usage by 16 bytes
by eliminating some local variables, and reducing the size
of scope for other locals.

Compile tested only.

Signed-off-by: Denys Vlasenko <vda.linux@xxxxxxxxxxxxxx>

P.S.

xfs_page_state_convert() carries the following comment:
 * Calling this without startio set means we are being asked to make a dirty
 * page ready for freeing it's buffers.  When called with startio set then
 * we are coming from writepage.
which leads to the following proposal: reimplement it as two
functions, one which work as if startio parameter == 0
and the other as if startio == 1.
This will result in a bit of code duplication, but reduces
stack usage on writepage path and allows for these two functions
to have more descriptive names. (Presently the meaning of this
function needs to be explained in that comment -> function
name is not descriptive enough, because it does different things
depending on startio value).

Do you like this idea?
--
vda

Attachment: stk2.diff
Description: Text Data

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