History

[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.

Badari Pulavarty committed 20 years ago

Commit 205f87f1 parent d48589b4 files · +17 −12Browse files

Unified · Split

4 files
  1. fs/buffer.c +4 −2
  2. fs/ocfs2/journal.c +1 −1
  3. fs/reiserfs/prints.c +1 −1
  4. include/linux/buffer_head.h +11 −8
fs/buffer.c+4−2
@@ -426,8 +426,10 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) · 425 unmodified lines
426 if (all_mapped) {426 if (all_mapped) {
427 printk("__find_get_block_slow() failed. "427 printk("__find_get_block_slow() failed. "
428 "block=%llu, b_blocknr=%llu\n",428 "block=%llu, b_blocknr=%llu\n",
429 (unsigned long long)block, (unsigned long long)bh->b_blocknr);429 (unsigned long long)block,
430 printk("b_state=0x%08lx, b_size=%u\n", bh->b_state, bh->b_size);430 (unsigned long long)bh->b_blocknr);
431 printk("b_state=0x%08lx, b_size=%zu\n",
432 bh->b_state, bh->b_size);
431 printk("device blocksize: %d\n", 1 << bd_inode->i_blkbits);433 printk("device blocksize: %d\n", 1 << bd_inode->i_blkbits);
432 }434 }
433out_unlock:435out_unlock:
fs/ocfs2/journal.c+1−1
@@ -377,7 +377,7 @@ int ocfs2_journal_access(struct ocfs2_journal_handle *handle, · 376 unmodified lines
377 BUG_ON(!bh);377 BUG_ON(!bh);
378 BUG_ON(!(handle->flags & OCFS2_HANDLE_STARTED));378 BUG_ON(!(handle->flags & OCFS2_HANDLE_STARTED));
379 379
380 mlog_entry("bh->b_blocknr=%llu, type=%d (\"%s\"), bh->b_size = %hu\n",380 mlog_entry("bh->b_blocknr=%llu, type=%d (\"%s\"), bh->b_size = %zu\n",
381 (unsigned long long)bh->b_blocknr, type,381 (unsigned long long)bh->b_blocknr, type,
382 (type == OCFS2_JOURNAL_ACCESS_CREATE) ?382 (type == OCFS2_JOURNAL_ACCESS_CREATE) ?
383 "OCFS2_JOURNAL_ACCESS_CREATE" :383 "OCFS2_JOURNAL_ACCESS_CREATE" :
fs/reiserfs/prints.c+1−1
@@ -143,7 +143,7 @@ static void sprintf_buffer_head(char *buf, struct buffer_head *bh) · 142 unmodified lines
143 char b[BDEVNAME_SIZE];143 char b[BDEVNAME_SIZE];
144 144
145 sprintf(buf,145 sprintf(buf,
146 "dev %s, size %d, blocknr %llu, count %d, state 0x%lx, page %p, (%s, %s, %s)",146 "dev %s, size %zd, blocknr %llu, count %d, state 0x%lx, page %p, (%s, %s, %s)",
147 bdevname(bh->b_bdev, b), bh->b_size,147 bdevname(bh->b_bdev, b), bh->b_size,
148 (unsigned long long)bh->b_blocknr, atomic_read(&(bh->b_count)),148 (unsigned long long)bh->b_blocknr, atomic_read(&(bh->b_count)),
149 bh->b_state, bh->b_page,149 bh->b_state, bh->b_page,
include/linux/buffer_head.h+11−8
@@ -46,25 +46,28 @@ struct address_space; · 45 unmodified lines
46typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);46typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
47 47
48/*48/*
49 * Keep related fields in common cachelines. The most commonly accessed49 * Historically, a buffer_head was used to map a single block
50 * field (b_state) goes at the start so the compiler does not generate50 * within a page, and of course as the unit of I/O through the
51 * indexed addressing for it.51 * filesystem and block layers. Nowadays the basic I/O unit
52 * is the bio, and buffer_heads are used for extracting block
53 * mappings (via a get_block_t call), for tracking state within
54 * a page (via a page_mapping) and for wrapping bio submission
55 * for backward compatibility reasons (e.g. submit_bh).
52 */56 */
53struct buffer_head {57struct buffer_head {
54 /* First cache line: */
55 unsigned long b_state; /* buffer state bitmap (see above) */58 unsigned long b_state; /* buffer state bitmap (see above) */
56 struct buffer_head *b_this_page;/* circular list of page's buffers */59 struct buffer_head *b_this_page;/* circular list of page's buffers */
57 struct page *b_page; /* the page this bh is mapped to */60 struct page *b_page; /* the page this bh is mapped to */
58 atomic_t b_count; /* users using this block */
59 u32 b_size; /* block size */
60 61
61 sector_t b_blocknr; /* block number */62 sector_t b_blocknr; /* start block number */
62 char *b_data; /* pointer to data block */63 size_t b_size; /* size of mapping */
64 char *b_data; /* pointer to data within the page */
63 65
64 struct block_device *b_bdev;66 struct block_device *b_bdev;
65 bh_end_io_t *b_end_io; /* I/O completion */67 bh_end_io_t *b_end_io; /* I/O completion */
66 void *b_private; /* reserved for b_end_io */68 void *b_private; /* reserved for b_end_io */
67 struct list_head b_assoc_buffers; /* associated with another mapping */69 struct list_head b_assoc_buffers; /* associated with another mapping */
70 atomic_t b_count; /* users using this buffer_head */
68};71};
69 72
70/*73/*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t