Commit 205f87f6 authored by Badari Pulavarty's avatar Badari Pulavarty Committed by Linus Torvalds

[PATCH] change buffer_head.b_size to size_t

Increase the size of the buffer_head b_size field (only) for 64 bit platforms.
Update some old and moldy comments in and around the structure as well.

The b_size increase allows us to perform larger mappings and allocations for
large I/O requests from userspace, which tie in with other changes allowing
the get_block_t() interface to map multiple blocks at once.
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
Signed-off-by: default avatarBadari Pulavarty <pbadari@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d48589bf
...@@ -426,8 +426,10 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) ...@@ -426,8 +426,10 @@ __find_get_block_slow(struct block_device *bdev, sector_t block)
if (all_mapped) { if (all_mapped) {
printk("__find_get_block_slow() failed. " printk("__find_get_block_slow() failed. "
"block=%llu, b_blocknr=%llu\n", "block=%llu, b_blocknr=%llu\n",
(unsigned long long)block, (unsigned long long)bh->b_blocknr); (unsigned long long)block,
printk("b_state=0x%08lx, b_size=%u\n", bh->b_state, bh->b_size); (unsigned long long)bh->b_blocknr);
printk("b_state=0x%08lx, b_size=%zu\n",
bh->b_state, bh->b_size);
printk("device blocksize: %d\n", 1 << bd_inode->i_blkbits); printk("device blocksize: %d\n", 1 << bd_inode->i_blkbits);
} }
out_unlock: out_unlock:
......
...@@ -377,7 +377,7 @@ int ocfs2_journal_access(struct ocfs2_journal_handle *handle, ...@@ -377,7 +377,7 @@ int ocfs2_journal_access(struct ocfs2_journal_handle *handle,
BUG_ON(!bh); BUG_ON(!bh);
BUG_ON(!(handle->flags & OCFS2_HANDLE_STARTED)); BUG_ON(!(handle->flags & OCFS2_HANDLE_STARTED));
mlog_entry("bh->b_blocknr=%llu, type=%d (\"%s\"), bh->b_size = %hu\n", mlog_entry("bh->b_blocknr=%llu, type=%d (\"%s\"), bh->b_size = %zu\n",
(unsigned long long)bh->b_blocknr, type, (unsigned long long)bh->b_blocknr, type,
(type == OCFS2_JOURNAL_ACCESS_CREATE) ? (type == OCFS2_JOURNAL_ACCESS_CREATE) ?
"OCFS2_JOURNAL_ACCESS_CREATE" : "OCFS2_JOURNAL_ACCESS_CREATE" :
......
...@@ -143,7 +143,7 @@ static void sprintf_buffer_head(char *buf, struct buffer_head *bh) ...@@ -143,7 +143,7 @@ static void sprintf_buffer_head(char *buf, struct buffer_head *bh)
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
sprintf(buf, sprintf(buf,
"dev %s, size %d, blocknr %llu, count %d, state 0x%lx, page %p, (%s, %s, %s)", "dev %s, size %zd, blocknr %llu, count %d, state 0x%lx, page %p, (%s, %s, %s)",
bdevname(bh->b_bdev, b), bh->b_size, bdevname(bh->b_bdev, b), bh->b_size,
(unsigned long long)bh->b_blocknr, atomic_read(&(bh->b_count)), (unsigned long long)bh->b_blocknr, atomic_read(&(bh->b_count)),
bh->b_state, bh->b_page, bh->b_state, bh->b_page,
......
...@@ -46,25 +46,28 @@ struct address_space; ...@@ -46,25 +46,28 @@ struct address_space;
typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate); typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
/* /*
* Keep related fields in common cachelines. The most commonly accessed * Historically, a buffer_head was used to map a single block
* field (b_state) goes at the start so the compiler does not generate * within a page, and of course as the unit of I/O through the
* indexed addressing for it. * filesystem and block layers. Nowadays the basic I/O unit
* is the bio, and buffer_heads are used for extracting block
* mappings (via a get_block_t call), for tracking state within
* a page (via a page_mapping) and for wrapping bio submission
* for backward compatibility reasons (e.g. submit_bh).
*/ */
struct buffer_head { struct buffer_head {
/* First cache line: */
unsigned long b_state; /* buffer state bitmap (see above) */ unsigned long b_state; /* buffer state bitmap (see above) */
struct buffer_head *b_this_page;/* circular list of page's buffers */ struct buffer_head *b_this_page;/* circular list of page's buffers */
struct page *b_page; /* the page this bh is mapped to */ struct page *b_page; /* the page this bh is mapped to */
atomic_t b_count; /* users using this block */
u32 b_size; /* block size */
sector_t b_blocknr; /* block number */ sector_t b_blocknr; /* start block number */
char *b_data; /* pointer to data block */ size_t b_size; /* size of mapping */
char *b_data; /* pointer to data within the page */
struct block_device *b_bdev; struct block_device *b_bdev;
bh_end_io_t *b_end_io; /* I/O completion */ bh_end_io_t *b_end_io; /* I/O completion */
void *b_private; /* reserved for b_end_io */ void *b_private; /* reserved for b_end_io */
struct list_head b_assoc_buffers; /* associated with another mapping */ struct list_head b_assoc_buffers; /* associated with another mapping */
atomic_t b_count; /* users using this buffer_head */
}; };
/* /*
......
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