lkml.org 
[lkml]   [2007]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
DateTue, 21 Aug 2007 09:09:33 +0200 (CEST)
FromGeert Uytterhoeven <>
SubjectRe: [PATCH 002 of 6] Introduce rq_for_each_segment replacing rq_for_each_bio
On Tue, 21 Aug 2007, Satyam Sharma wrote:
> On Mon, 20 Aug 2007, Geert Uytterhoeven wrote:
> > On Sat, 18 Aug 2007, Satyam Sharma wrote:
> > > On Sat, 18 Aug 2007, Jan Engelhardt wrote:
> > > > On Aug 18 2007 20:07, Satyam Sharma wrote:
> > > > >On Fri, 17 Aug 2007, Geert Uytterhoeven wrote:
> > > > >> On Thu, 16 Aug 2007, NeilBrown wrote:
> > > > >> [...]
> > > > >> > dev_dbg(&dev->sbd.core,
> > > > >> > "%s:%u: bio %u: %u segs %u sectors from %lu\n",
> ^^^
>
> > > > >> > - __func__, __LINE__, i, bio_segments(bio),
> > > > >> > - bio_sectors(bio), sector);
> > > > >> > - bio_for_each_segment(bvec, bio, j) {
> > > > >> > + __func__, __LINE__, i, bio_segments(iter.bio),
> > > > >> > + bio_sectors(iter.bio),
> > > > >> > + (unsigned long)iter.bio->bi_sector);
> ^^^^^^^^^^^^^^^ ^^^^^^^^^
>
> > > > >> Superfluous cast: PS3 is 64-bit only, and casts are evil.
> > > >
> > > > bi_sector is sector_t. The cast is ok, because printf will warn, and rightfully
> > > > so since sector_t may just change its shape underneath.
> > >
> > > Oh yeah, that's why the _cast_ _is_ needed in the first place, by the way.
> > > I was mentioning why the cast itself should be (unsigned long long) otoh.
> >
> > On 64-bit platforms, sector_t (which is either u64 or unsigned long, depending
> > on CONFIG_LBD) is unsigned long, so there's no need for a cast. Hence there's
> > no compiler warning to be silenced by adding the cast.
>
> This is turning rather funny :-)
>
> * Why the printk() conversion specifier must be "%llu"?
>
> When reusing parts of this code (such as this debug message) for another
> 32-bit driver (we certainly seem to care about this, as per your reply),
> the largest size of sector_t can be "unsigned long long", thereby causing
> truncated output, and the following warning:
>
> warning: format
\
 
 \ /
  Last update: 2007-08-21 09:11    [from the cache]
©2003-2010