Commit 2d8f24d0 authored by Andrew Morton's avatar Andrew Morton Committed by Arnaldo Carvalho de Melo

[PATCH] larger b_size, and misc fixlets

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).
parent 943acef9
...@@ -179,8 +179,8 @@ __clear_page_buffers(struct page *page) ...@@ -179,8 +179,8 @@ __clear_page_buffers(struct page *page)
static void buffer_io_error(struct buffer_head *bh) static void buffer_io_error(struct buffer_head *bh)
{ {
printk(KERN_ERR "Buffer I/O error on device %s, logical block %ld\n", printk(KERN_ERR "Buffer I/O error on device %s, logical block %Ld\n",
bdevname(bh->b_bdev), bh->b_blocknr); bdevname(bh->b_bdev), (u64)bh->b_blocknr);
} }
/* /*
...@@ -189,12 +189,12 @@ static void buffer_io_error(struct buffer_head *bh) ...@@ -189,12 +189,12 @@ static void buffer_io_error(struct buffer_head *bh)
*/ */
void end_buffer_io_sync(struct buffer_head *bh, int uptodate) void end_buffer_io_sync(struct buffer_head *bh, int uptodate)
{ {
if (!uptodate) if (uptodate) {
buffer_io_error(bh);
if (uptodate)
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
else } else {
buffer_io_error(bh);
clear_buffer_uptodate(bh); clear_buffer_uptodate(bh);
}
unlock_buffer(bh); unlock_buffer(bh);
put_bh(bh); put_bh(bh);
} }
...@@ -519,14 +519,12 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) ...@@ -519,14 +519,12 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate)
BUG_ON(!buffer_async_read(bh)); BUG_ON(!buffer_async_read(bh));
if (!uptodate)
buffer_io_error(bh);
page = bh->b_page; page = bh->b_page;
if (uptodate) { if (uptodate) {
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
} else { } else {
clear_buffer_uptodate(bh); clear_buffer_uptodate(bh);
buffer_io_error(bh);
SetPageError(page); SetPageError(page);
} }
...@@ -579,13 +577,11 @@ static void end_buffer_async_write(struct buffer_head *bh, int uptodate) ...@@ -579,13 +577,11 @@ static void end_buffer_async_write(struct buffer_head *bh, int uptodate)
BUG_ON(!buffer_async_write(bh)); BUG_ON(!buffer_async_write(bh));
if (!uptodate)
buffer_io_error(bh);
page = bh->b_page; page = bh->b_page;
if (uptodate) { if (uptodate) {
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
} else { } else {
buffer_io_error(bh);
clear_buffer_uptodate(bh); clear_buffer_uptodate(bh);
SetPageError(page); SetPageError(page);
} }
...@@ -907,6 +903,7 @@ create_buffers(struct page * page, unsigned long size, int async) ...@@ -907,6 +903,7 @@ create_buffers(struct page * page, unsigned long size, int async)
bh->b_bdev = NULL; bh->b_bdev = NULL;
bh->b_this_page = head; bh->b_this_page = head;
bh->b_blocknr = -1;
head = bh; head = bh;
bh->b_state = 0; bh->b_state = 0;
...@@ -2442,7 +2439,6 @@ static void init_buffer_head(void *data, kmem_cache_t *cachep, unsigned long fla ...@@ -2442,7 +2439,6 @@ static void init_buffer_head(void *data, kmem_cache_t *cachep, unsigned long fla
struct buffer_head * bh = (struct buffer_head *)data; struct buffer_head * bh = (struct buffer_head *)data;
memset(bh, 0, sizeof(*bh)); memset(bh, 0, sizeof(*bh));
bh->b_blocknr = -1;
INIT_LIST_HEAD(&bh->b_assoc_buffers); INIT_LIST_HEAD(&bh->b_assoc_buffers);
} }
} }
......
...@@ -44,7 +44,7 @@ struct buffer_head { ...@@ -44,7 +44,7 @@ struct buffer_head {
struct page *b_page; /* the page this bh is mapped to */ struct page *b_page; /* the page this bh is mapped to */
sector_t b_blocknr; /* block number */ sector_t b_blocknr; /* block number */
unsigned short b_size; /* block size */ u32 b_size; /* block size */
char *b_data; /* pointer to data block */ char *b_data; /* pointer to data block */
struct block_device *b_bdev; struct block_device *b_bdev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment