* [patch 6/15] larger b_size, and misc fixlets
@ 2002-05-19 19:39 Andrew Morton
2002-05-19 22:15 ` Andreas Dilger
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2002-05-19 19:39 UTC (permalink / raw)
To: Linus Torvalds; +Cc: lkml
Miscellany.
- make the printk in buffer_io_error() sector_t-aware.
- Some buffer.c cleanups from AntonA: remove a couple of !uptodate
checks, and set a new buffer's b_blocknr to -1 in a more sensible
place.
- Make buffer_head.b_size a 32-bit quantity. Needed for 64k pagesize
on ia64. Does not increase sizeof(struct buffer_head).
=====================================
--- 2.5.16/fs/buffer.c~sector_t-printing Sun May 19 11:49:47 2002
+++ 2.5.16-akpm/fs/buffer.c Sun May 19 12:02:57 2002
@@ -179,8 +179,8 @@ __clear_page_buffers(struct page *page)
static void buffer_io_error(struct buffer_head *bh)
{
- printk(KERN_ERR "Buffer I/O error on device %s, logical block %ld\n",
- bdevname(bh->b_bdev), bh->b_blocknr);
+ printk(KERN_ERR "Buffer I/O error on device %s, logical block %Ld\n",
+ bdevname(bh->b_bdev), (u64)bh->b_blocknr);
}
/*
@@ -189,12 +189,12 @@ static void buffer_io_error(struct buffe
*/
void end_buffer_io_sync(struct buffer_head *bh, int uptodate)
{
- if (!uptodate)
- buffer_io_error(bh);
- if (uptodate)
+ if (uptodate) {
set_buffer_uptodate(bh);
- else
+ } else {
+ buffer_io_error(bh);
clear_buffer_uptodate(bh);
+ }
unlock_buffer(bh);
put_bh(bh);
}
@@ -519,14 +519,12 @@ static void end_buffer_async_read(struct
BUG_ON(!buffer_async_read(bh));
- if (!uptodate)
- buffer_io_error(bh);
-
page = bh->b_page;
if (uptodate) {
set_buffer_uptodate(bh);
} else {
clear_buffer_uptodate(bh);
+ buffer_io_error(bh);
SetPageError(page);
}
@@ -579,13 +577,11 @@ static void end_buffer_async_write(struc
BUG_ON(!buffer_async_write(bh));
- if (!uptodate)
- buffer_io_error(bh);
-
page = bh->b_page;
if (uptodate) {
set_buffer_uptodate(bh);
} else {
+ buffer_io_error(bh);
clear_buffer_uptodate(bh);
SetPageError(page);
}
@@ -907,6 +903,7 @@ try_again:
bh->b_bdev = NULL;
bh->b_this_page = head;
+ bh->b_blocknr = -1;
head = bh;
bh->b_state = 0;
@@ -2442,7 +2439,6 @@ static void init_buffer_head(void *data,
struct buffer_head * bh = (struct buffer_head *)data;
memset(bh, 0, sizeof(*bh));
- bh->b_blocknr = -1;
INIT_LIST_HEAD(&bh->b_assoc_buffers);
}
}
--- 2.5.16/include/linux/buffer_head.h~sector_t-printing Sun May 19 11:49:47 2002
+++ 2.5.16-akpm/include/linux/buffer_head.h Sun May 19 12:02:57 2002
@@ -44,7 +44,7 @@ struct buffer_head {
struct page *b_page; /* the page this bh is mapped to */
sector_t b_blocknr; /* block number */
- unsigned short b_size; /* block size */
+ u32 b_size; /* block size */
char *b_data; /* pointer to data block */
struct block_device *b_bdev;
-
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch 6/15] larger b_size, and misc fixlets
2002-05-19 19:39 [patch 6/15] larger b_size, and misc fixlets Andrew Morton
@ 2002-05-19 22:15 ` Andreas Dilger
2002-05-19 22:53 ` Andrew Morton
0 siblings, 1 reply; 5+ messages in thread
From: Andreas Dilger @ 2002-05-19 22:15 UTC (permalink / raw)
To: Andrew Morton; +Cc: lkml
On May 19, 2002 12:39 -0700, Andrew Morton wrote:
> - make the printk in buffer_io_error() sector_t-aware.
> =====================================
> --- 2.5.16/fs/buffer.c~sector_t-printing Sun May 19 11:49:47 2002
> +++ 2.5.16-akpm/fs/buffer.c Sun May 19 12:02:57 2002
> @@ -179,8 +179,8 @@ __clear_page_buffers(struct page *page)
>
> static void buffer_io_error(struct buffer_head *bh)
> {
> - printk(KERN_ERR "Buffer I/O error on device %s, logical block %ld\n",
> - bdevname(bh->b_bdev), bh->b_blocknr);
> + printk(KERN_ERR "Buffer I/O error on device %s, logical block %Ld\n",
> + bdevname(bh->b_bdev), (u64)bh->b_blocknr);
> }
Not that I'm a 64-bit system user/developer, but it is my understanding
that u64 == long on a 64-bit platform, so your cast to u64 does not
actually change the type of b_blocknr as far as printk is concerned.
You would need to cast it to unsigned long long instead.
Cheers, Andreas
--
Andreas Dilger
http://www-mddsp.enel.ucalgary.ca/People/adilger/
http://sourceforge.net/projects/ext2resize/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch 6/15] larger b_size, and misc fixlets
2002-05-19 22:15 ` Andreas Dilger
@ 2002-05-19 22:53 ` Andrew Morton
2002-05-19 22:59 ` Anton Altaparmakov
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2002-05-19 22:53 UTC (permalink / raw)
To: Andreas Dilger; +Cc: lkml
Andreas Dilger wrote:
>
> On May 19, 2002 12:39 -0700, Andrew Morton wrote:
> > - make the printk in buffer_io_error() sector_t-aware.
> > =====================================
> > --- 2.5.16/fs/buffer.c~sector_t-printing Sun May 19 11:49:47 2002
> > +++ 2.5.16-akpm/fs/buffer.c Sun May 19 12:02:57 2002
> > @@ -179,8 +179,8 @@ __clear_page_buffers(struct page *page)
> >
> > static void buffer_io_error(struct buffer_head *bh)
> > {
> > - printk(KERN_ERR "Buffer I/O error on device %s, logical block %ld\n",
> > - bdevname(bh->b_bdev), bh->b_blocknr);
> > + printk(KERN_ERR "Buffer I/O error on device %s, logical block %Ld\n",
> > + bdevname(bh->b_bdev), (u64)bh->b_blocknr);
> > }
>
> Not that I'm a 64-bit system user/developer, but it is my understanding
> that u64 == long on a 64-bit platform, so your cast to u64 does not
> actually change the type of b_blocknr as far as printk is concerned.
> You would need to cast it to unsigned long long instead.
>
Yes, I suppose so. That more closely matches what "%L" does.
-
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch 6/15] larger b_size, and misc fixlets
2002-05-19 22:53 ` Andrew Morton
@ 2002-05-19 22:59 ` Anton Altaparmakov
0 siblings, 0 replies; 5+ messages in thread
From: Anton Altaparmakov @ 2002-05-19 22:59 UTC (permalink / raw)
To: Andrew Morton; +Cc: Andreas Dilger, lkml
On Sun, 19 May 2002, Andrew Morton wrote:
> Andreas Dilger wrote:
> > On May 19, 2002 12:39 -0700, Andrew Morton wrote:
> > > - printk(KERN_ERR "Buffer I/O error on device %s, logical block %ld\n",
> > > - bdevname(bh->b_bdev), bh->b_blocknr);
> > > + printk(KERN_ERR "Buffer I/O error on device %s, logical block %Ld\n",
> > > + bdevname(bh->b_bdev), (u64)bh->b_blocknr);
> >
> > Not that I'm a 64-bit system user/developer, but it is my understanding
> > that u64 == long on a 64-bit platform, so your cast to u64 does not
> > actually change the type of b_blocknr as far as printk is concerned.
> > You would need to cast it to unsigned long long instead.
>
> Yes, I suppose so. That more closely matches what "%L" does.
/me can't help it: Didn't I say earlier on that one has to use (unsigned)
long long and not u64? (-; But noone would listen...
But to be fully correct, if you want unsigned long long you really ought
to write %Lu not %Ld... (-8
Cheers,
Anton
--
Anton Altaparmakov <aia21 at cantab.net> (replace at with @)
Linux NTFS maintainer / IRC: #ntfs on irc.openprojects.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch 6/15] larger b_size, and misc fixlets
[not found] <368842013@toto.iv>
@ 2002-05-20 2:09 ` Peter Chubb
0 siblings, 0 replies; 5+ messages in thread
From: Peter Chubb @ 2002-05-20 2:09 UTC (permalink / raw)
To: Anton Altaparmakov; +Cc: Andrew Morton, Andreas Dilger, lkml
>>>>> "Anton" == Anton Altaparmakov <aia21@cantab.net> writes:
>> > Not that I'm a 64-bit system user/developer, but it is my
>> understanding > that u64 == long on a 64-bit platform, so your cast
>> to u64 does not > actually change the type of b_blocknr as far as
>> printk is concerned. > You would need to cast it to unsigned long
>> long instead.
>>
>> Yes, I suppose so. That more closely matches what "%L" does.
Anton> /me can't help it: Didn't I say earlier on that one has to use
Anton> (unsigned) long long and not u64? (-; But noone would listen...
The current C standard guarantees that long long is *at least* 64
bits.
So you're right. Can we introduce a new pair of types, ull_t and ll_t
to reduce typing? (unsigned long long) tends to make lines overflow
the 80-char boundary bit much, but (ull_t) is a lot shorter.
Peter C
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-05-20 2:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-19 19:39 [patch 6/15] larger b_size, and misc fixlets Andrew Morton
2002-05-19 22:15 ` Andreas Dilger
2002-05-19 22:53 ` Andrew Morton
2002-05-19 22:59 ` Anton Altaparmakov
[not found] <368842013@toto.iv>
2002-05-20 2:09 ` Peter Chubb
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.