From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Dilger Subject: Re: [RFC] quota: 64-bit limits with vfs Date: Sat, 15 Mar 2008 12:23:16 +0800 Message-ID: <20080315042316.GP3542@webber.adilger.int> References: <200803061641.12274.andrew.perepechko@sun.com> <200803102013.11097.andrew.perepechko@sun.com> <20080310172028.GD30435@duck.suse.cz> <200803141608.10761.andrew.perepechko@sun.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT Cc: Jan Kara , linux-fsdevel@vger.kernel.org, Johann Lombardi , Zhiyong Landen tian , Alex Lyashkov To: Andrew Perepechko Return-path: Received: from sca-es-mail-1.Sun.COM ([192.18.43.132]:53484 "EHLO sca-es-mail-1.sun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750856AbYCOEXj (ORCPT ); Sat, 15 Mar 2008 00:23:39 -0400 Received: from fe-sfbay-09.sun.com ([192.18.43.129]) by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id m2F4NcYL002707 for ; Fri, 14 Mar 2008 21:23:38 -0700 (PDT) Received: from conversion-daemon.fe-sfbay-09.sun.com by fe-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JXR004017XP4R00@fe-sfbay-09.sun.com> (original mail from adilger@sun.com) for linux-fsdevel@vger.kernel.org; Fri, 14 Mar 2008 21:23:38 -0700 (PDT) In-reply-to: <200803141608.10761.andrew.perepechko@sun.com> Content-disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mar 14, 2008 16:08 +0300, Andrew Perepechko wrote: > @@ -395,7 +463,10 @@ static int v2_write_dquot(struct dquot * > { > int type = dquot->dq_type; > ssize_t ret; > - struct v2_disk_dqblk ddquot, empty; > + union v2_disk_dqblk ddquot, empty; > + struct super_block *sb = dquot->dq_sb; > + uint rev = sb_dqopt(sb)->info[type].u.v2_i.dqi_revision; > + uint dqblksz = v2_dqblksz(rev); In a few places you add new on-stack variables like "sb", but they aren't used more than 1 or 2 times. While it makes the code a tiny bit clearer (though not largely so for "sb" because it is only dquot->dq_sb) it does increase the stack usage, and that is never a good idea. > + union v2_disk_dqblk fakedquot; > > + memset(&fakedquot, 0, dqblksz); > + for (i = 0; i < dqstrinblk; i++) > + if (!DQF_GET(ddquot+i, rev, dqb_id) && > + memcmp(&fakedquot, ddquot+i, dqblksz)) Hmm, allocating "fakedquot" on the stack just to compare it to zero doesn't seem like a good use of space. What about doing the memcmp() against page_address(ZERO_PAGE(0))? It might be nice to have a permanent mapping of ZERO_PAGE(0) like void *zero_buffer that can be used for this. Cheers, Andreas -- Andreas Dilger Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc.