Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753094Ab1F3WlP (ORCPT ); Thu, 30 Jun 2011 18:41:15 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:38560 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751407Ab1F3WlO (ORCPT ); Thu, 30 Jun 2011 18:41:14 -0400 Date: Fri, 1 Jul 2011 01:40:19 +0300 From: Dan Carpenter To: Dan Magenheimer Cc: Greg Kroah-Hartman , Marcus Klemm , kvm@vger.kernel.org, Konrad Wilk , linux-kernel@vger.kernel.org, linux-mm , Seth Jennings , devel@linuxdriverproject.org Subject: Re: [PATCH v2] staging: zcache: support multiple clients, prep for KVM and RAMster Message-ID: <20110630224019.GC2544@shale.localdomain> References: <1d15f28a-56df-4cf4-9dd9-1032f211c0d0@default> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1d15f28a-56df-4cf4-9dd9-1032f211c0d0@default> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1456 Lines: 54 On Thu, Jun 30, 2011 at 12:01:08PM -0700, Dan Magenheimer wrote: > +static int zv_curr_dist_counts_show(char *buf) > +{ > + unsigned long i, n, chunks = 0, sum_total_chunks = 0; > + char *p = buf; > + > + for (i = 0; i <= NCHUNKS - 1; i++) { It's more common to write the condition as: i < NCHUNKS. > + n = zv_curr_dist_counts[i]; zv_curr_dist_counts has NCHUNKS + 1 elements so we never print display the final element. I don't know this coe, so I could be wrong but I think that we could make zv_curr_dist_counts only hold NCHUNKS elements. > + p += sprintf(p, "%lu ", n); > + chunks += n; > + sum_total_chunks += i * n; > + } > + p += sprintf(p, "mean:%lu\n", > + chunks == 0 ? 0 : sum_total_chunks / chunks); > + return p - buf; > +} > + > +static int zv_cumul_dist_counts_show(char *buf) > +{ > + unsigned long i, n, chunks = 0, sum_total_chunks = 0; > + char *p = buf; > + > + for (i = 0; i <= NCHUNKS - 1; i++) { > + n = zv_cumul_dist_counts[i]; Same situation. > + p += sprintf(p, "%lu ", n); > + chunks += n; > + sum_total_chunks += i * n; > + } > + p += sprintf(p, "mean:%lu\n", > + chunks == 0 ? 0 : sum_total_chunks / chunks); > + return p - buf; > +} > + regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/