From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751936Ab1GZHf3 (ORCPT ); Tue, 26 Jul 2011 03:35:29 -0400 Received: from mail.linux-iscsi.org ([67.23.28.174]:43721 "EHLO linux-iscsi.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751142Ab1GZHfX (ORCPT ); Tue, 26 Jul 2011 03:35:23 -0400 Subject: Re: [GIT PULL] iscsi-target merge for v3.1-rc1 From: "Nicholas A. Bellinger" To: Linus Torvalds Cc: Andrew Morton , target-devel , linux-scsi , LKML , Christoph Hellwig , Andy Grover , Hannes Reinecke , Roland Dreier , James Bottomley , Boaz Harrosh , Mike Christie In-Reply-To: References: <1311462975.31450.356.camel@haakon2.linux-iscsi.org> <20110725163739.5c19b04d.akpm@linux-foundation.org> <20110725165057.9701f16b.akpm@linux-foundation.org> <1311663071.17766.230.camel@haakon2.linux-iscsi.org> Content-Type: text/plain Date: Tue, 26 Jul 2011 00:26:01 -0700 Message-Id: <1311665161.17766.234.camel@haakon2.linux-iscsi.org> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2011-07-26 at 00:09 -0700, Linus Torvalds wrote: > On Mon, Jul 25, 2011 at 11:51 PM, Nicholas A. Bellinger > wrote: > > > > How about the following to add a new DIV_ROUND_UP_ULL macro > > Hmm. > > > #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) > > +#define DIV_ROUND_UP_ULL(n,d) ( \ > > +{ \ > > + unsigned long long _tmp = n, _off; \ > > + int _res; \ > > + /* Round up using asm/div64.h:do_div */ \ > > + _off = do_div(_tmp, d); \ > > + if (_off != 0) \ > > + _tmp++; \ > > + _res = _tmp; \ > > +} \ > > +) > > That looks buggy. Why the "_res = _tmp" there? All that does is to > truncate the result to "int", which looks bogus. > > And it just looks unnecessarily complicated. Just a simple > > #define DIV_ROUND_UP_ULL(ll,d) \ > ({ unsigned long long _tmp = (ll)+(d)-1; do_div(_tmp, d); _tmp; }) > > looks like it would work and be simpler. Avoid the conditional, do the > same "add 'd-1' thing as the regular ROUND_UP(). > > Untested. And not much thinking involved. > Fixing this up in lio-core-2.6.git now and pushing out into target-pending.git/for-next now unless you have any other concerns. Thank you, --nab