From: Adrian Bunk <bunk@stusta.de>
To: Andrew Morton <akpm@linux-foundation.org>, Nick Piggin <npiggin@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: [-mm patch] remove nobh_{prepare,commit}_write()
Date: Fri, 15 Jun 2007 00:15:55 +0200 [thread overview]
Message-ID: <20070614221555.GY3588@stusta.de> (raw)
In-Reply-To: <20070606220313.8f7c1fab.akpm@linux-foundation.org>
nobh_{prepare,commit}_write() are no longer used.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
---
fs/buffer.c | 175 ------------------------------------
include/linux/buffer_head.h | 2
2 files changed, 177 deletions(-)
--- linux-2.6.22-rc4-mm2/include/linux/buffer_head.h.old 2007-06-14 01:54:54.000000000 +0200
+++ linux-2.6.22-rc4-mm2/include/linux/buffer_head.h 2007-06-14 01:55:08.000000000 +0200
@@ -224,8 +224,6 @@
int generic_commit_write(struct file *, struct page *, unsigned, unsigned);
int block_truncate_page(struct address_space *, loff_t, get_block_t *);
int file_fsync(struct file *, struct dentry *, int);
-int nobh_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
-int nobh_commit_write(struct file *, struct page *, unsigned, unsigned);
int nobh_truncate_page(struct address_space *, loff_t);
int nobh_writepage(struct page *page, get_block_t *get_block,
struct writeback_control *wbc);
--- linux-2.6.22-rc4-mm2/fs/buffer.c.old 2007-06-14 01:55:22.000000000 +0200
+++ linux-2.6.22-rc4-mm2/fs/buffer.c 2007-06-14 01:56:12.000000000 +0200
@@ -2315,181 +2315,6 @@
/*
- * nobh_prepare_write()'s prereads are special: the buffer_heads are freed
- * immediately, while under the page lock. So it needs a special end_io
- * handler which does not touch the bh after unlocking it.
- *
- * Note: unlock_buffer() sort-of does touch the bh after unlocking it, but
- * a race there is benign: unlock_buffer() only use the bh's address for
- * hashing after unlocking the buffer, so it doesn't actually touch the bh
- * itself.
- */
-static void end_buffer_read_nobh(struct buffer_head *bh, int uptodate)
-{
- if (uptodate) {
- set_buffer_uptodate(bh);
- } else {
- /* This happens, due to failed READA attempts. */
- clear_buffer_uptodate(bh);
- }
- unlock_buffer(bh);
-}
-
-/*
- * On entry, the page is fully not uptodate.
- * On exit the page is fully uptodate in the areas outside (from,to)
- */
-int nobh_prepare_write(struct page *page, unsigned from, unsigned to,
- get_block_t *get_block)
-{
- struct inode *inode = page->mapping->host;
- const unsigned blkbits = inode->i_blkbits;
- const unsigned blocksize = 1 << blkbits;
- struct buffer_head map_bh;
- struct buffer_head *read_bh[MAX_BUF_PER_PAGE];
- unsigned block_in_page;
- unsigned block_start;
- sector_t block_in_file;
- char *kaddr;
- int nr_reads = 0;
- int i;
- int ret = 0;
- int is_mapped_to_disk = 1;
-
- if (PageMappedToDisk(page))
- return 0;
-
- block_in_file = (sector_t)page->index << (PAGE_CACHE_SHIFT - blkbits);
- map_bh.b_page = page;
-
- /*
- * We loop across all blocks in the page, whether or not they are
- * part of the affected region. This is so we can discover if the
- * page is fully mapped-to-disk.
- */
- for (block_start = 0, block_in_page = 0;
- block_start < PAGE_CACHE_SIZE;
- block_in_page++, block_start += blocksize) {
- unsigned block_end = block_start + blocksize;
- int create;
-
- map_bh.b_state = 0;
- create = 1;
- if (block_start >= to)
- create = 0;
- map_bh.b_size = blocksize;
- ret = get_block(inode, block_in_file + block_in_page,
- &map_bh, create);
- if (ret)
- goto failed;
- if (!buffer_mapped(&map_bh))
- is_mapped_to_disk = 0;
- if (buffer_new(&map_bh))
- unmap_underlying_metadata(map_bh.b_bdev,
- map_bh.b_blocknr);
- if (PageUptodate(page))
- continue;
- if (buffer_new(&map_bh) || !buffer_mapped(&map_bh)) {
- kaddr = kmap_atomic(page, KM_USER0);
- if (block_start < from)
- memset(kaddr+block_start, 0, from-block_start);
- if (block_end > to)
- memset(kaddr + to, 0, block_end - to);
- flush_dcache_page(page);
- kunmap_atomic(kaddr, KM_USER0);
- continue;
- }
- if (buffer_uptodate(&map_bh))
- continue; /* reiserfs does this */
- if (block_start < from || block_end > to) {
- struct buffer_head *bh = alloc_buffer_head(GFP_NOFS);
-
- if (!bh) {
- ret = -ENOMEM;
- goto failed;
- }
- bh->b_state = map_bh.b_state;
- atomic_set(&bh->b_count, 0);
- bh->b_this_page = NULL;
- bh->b_page = page;
- bh->b_blocknr = map_bh.b_blocknr;
- bh->b_size = blocksize;
- bh->b_data = (char *)(long)block_start;
- bh->b_bdev = map_bh.b_bdev;
- bh->b_private = NULL;
- read_bh[nr_reads++] = bh;
- }
- }
-
- if (nr_reads) {
- struct buffer_head *bh;
-
- /*
- * The page is locked, so these buffers are protected from
- * any VM or truncate activity. Hence we don't need to care
- * for the buffer_head refcounts.
- */
- for (i = 0; i < nr_reads; i++) {
- bh = read_bh[i];
- lock_buffer(bh);
- bh->b_end_io = end_buffer_read_nobh;
- submit_bh(READ, bh);
- }
- for (i = 0; i < nr_reads; i++) {
- bh = read_bh[i];
- wait_on_buffer(bh);
- if (!buffer_uptodate(bh))
- ret = -EIO;
- free_buffer_head(bh);
- read_bh[i] = NULL;
- }
- if (ret)
- goto failed;
- }
-
- if (is_mapped_to_disk)
- SetPageMappedToDisk(page);
-
- return 0;
-
-failed:
- for (i = 0; i < nr_reads; i++) {
- if (read_bh[i])
- free_buffer_head(read_bh[i]);
- }
-
- /*
- * Error recovery is pretty slack. Clear the page and mark it dirty
- * so we'll later zero out any blocks which _were_ allocated.
- */
- zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0);
- SetPageUptodate(page);
- set_page_dirty(page);
- return ret;
-}
-EXPORT_SYMBOL(nobh_prepare_write);
-
-/*
- * Make sure any changes to nobh_commit_write() are reflected in
- * nobh_truncate_page(), since it doesn't call commit_write().
- */
-int nobh_commit_write(struct file *file, struct page *page,
- unsigned from, unsigned to)
-{
- struct inode *inode = page->mapping->host;
- loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
-
- SetPageUptodate(page);
- set_page_dirty(page);
- if (pos > inode->i_size) {
- i_size_write(inode, pos);
- mark_inode_dirty(inode);
- }
- return 0;
-}
-EXPORT_SYMBOL(nobh_commit_write);
-
-/*
* nobh_writepage() - based on block_full_write_page() except
* that it tries to operate without attaching bufferheads to
* the page.
next prev parent reply other threads:[~2007-06-14 22:17 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-07 5:03 2.6.22-rc4-mm2 Andrew Morton
2007-06-07 6:42 ` 2.6.22-rc4-mm2 William Lee Irwin III
2007-06-07 6:51 ` 2.6.22-rc4-mm2 Andrew Morton
2007-06-07 6:55 ` 2.6.22-rc4-mm2 William Lee Irwin III
2007-06-07 7:01 ` 2.6.22-rc4-mm2 Andrew Morton
2007-06-07 7:04 ` 2.6.22-rc4-mm2 William Lee Irwin III
2007-06-07 7:05 ` 2.6.22-rc4-mm2 William Lee Irwin III
2007-06-07 7:19 ` 2.6.22-rc4-mm2 Andrew Morton
2007-06-07 7:34 ` 2.6.22-rc4-mm2 William Lee Irwin III
2007-06-07 7:11 ` 2.6.22-rc4-mm2 Paul Mundt
2007-06-07 9:19 ` 2.6.22-rc4-mm2 Manuel Lauss
2007-06-07 9:37 ` 2.6.22-rc4-mm2 Paul Mundt
2007-06-07 9:46 ` 2.6.22-rc4-mm2 Manuel Lauss
2007-06-07 20:01 ` 2.6.22-rc4-mm2 Adrian Bunk
2007-06-07 20:14 ` 2.6.22-rc4-mm2 Sam Ravnborg
2007-06-07 11:07 ` 2.6.22-rc4-mm2 Michal Piotrowski
2007-06-07 15:26 ` 2.6.22-rc4-mm2 Andrew Morton
2007-06-07 14:29 ` 2.6.22-rc4-mm2 Valdis.Kletnieks
2007-06-07 15:37 ` 2.6.22-rc4-mm2 - usb-storage Peter Zijlstra
2007-06-07 22:20 ` [usb-storage] " Alan Stern
2007-06-08 8:55 ` Peter Zijlstra
2007-06-08 14:16 ` Alan Stern
2007-06-08 16:30 ` Peter Zijlstra
2007-06-08 16:54 ` Alan Stern
2007-06-08 16:55 ` Peter Zijlstra
2007-06-14 22:47 ` Jeremy Fitzhardinge
2007-06-14 22:58 ` Peter Zijlstra
2007-06-14 23:20 ` Jeremy Fitzhardinge
2007-06-07 19:37 ` 2.6.22-rc4-mm2 Joseph Fannin
2007-06-07 20:31 ` 2.6.22-rc4-mm2 Andrew Morton
2007-06-07 21:46 ` 2.6.22-rc4-mm2: Assigning IP address fails Joseph Fannin
2007-06-07 22:06 ` Andrew Morton
2007-06-07 22:54 ` Herbert Xu
2007-06-08 1:35 ` David Miller
2007-06-12 0:07 ` 2.6.22-rc4-mm2: kvm compile breakage with X86_CMPXCHG64=n Adrian Bunk
2007-06-12 3:22 ` Dave Jones
2007-06-12 22:03 ` Andrew Morton
2007-06-12 22:16 ` Dave Jones
2007-06-12 22:43 ` Andrew Morton
2007-06-12 22:48 ` Dave Jones
2007-06-12 22:37 ` Adrian Bunk
2007-06-12 6:00 ` Avi Kivity
2007-06-12 11:07 ` [-mm patch] make cmdline_parse_kernelcore() static Adrian Bunk
2007-06-12 12:52 ` Mel Gorman
2007-06-12 11:07 ` [-mm patch] make mm/swap_prefetch.c:remove_from_swapped_list() static Adrian Bunk
2007-06-12 11:16 ` Con Kolivas
2007-06-12 23:03 ` [-mm patch] make drivers/acpi/osl.c:osi_linux static Adrian Bunk
2007-06-12 23:03 ` [-mm patch] drivers/acpi/processor_throttling.c: make 2 functions static Adrian Bunk
2007-06-12 23:03 ` [-mm patch] drivers/ata/sata_nv.c: make 3 " Adrian Bunk
2007-06-12 23:03 ` [-mm patch] make drivers/char/selection.c:store_utf8() static Adrian Bunk
2007-06-12 23:03 ` [-mm patch] drivers/cpuidle/governors/menu.c: make a struct static Adrian Bunk
2007-06-13 8:33 ` WARNING: at drivers/usb/core/urb.c:293 usb_submit_urb() [Was: 2.6.22-rc4-mm2] Jiri Slaby
2007-06-13 8:46 ` Jiri Slaby
2007-06-13 9:35 ` [Serial port bug?] was Re: 2.6.22-rc4-mm2 Reuben Farrelly
2007-06-14 22:15 ` [-mm patch] make fs/buffer.c:cont_expand_zero() static Adrian Bunk
2007-06-15 1:36 ` Nick Piggin
2007-06-14 22:15 ` Adrian Bunk [this message]
2007-06-26 20:32 ` [-mm patch] remove nobh_{prepare,commit}_write() Andrew Morton
2007-06-26 20:48 ` Dave Kleikamp
2007-06-26 21:23 ` Andrew Morton
2007-06-26 21:33 ` Randy Dunlap
2007-06-27 1:39 ` Nick Piggin
2007-06-14 22:15 ` [-mm patch] make fs/inode.c:wake_up_inode() static Adrian Bunk
2007-06-14 22:16 ` [-mm patch] make fs/libfs.c:simple_commit_write() static Adrian Bunk
2007-06-14 22:16 ` [-mm patch] fs/reiserfs/: cleanups Adrian Bunk
2007-06-15 1:37 ` Nick Piggin
2007-06-14 22:16 ` [-mm patch] make init/do_mounts.c:root_wait static Adrian Bunk
2007-06-14 22:16 ` [-mm patch] drivers/ide/ide-dma.c: unexport ide_set_dma Adrian Bunk
2007-06-16 0:18 ` Bartlomiej Zolnierkiewicz
2007-06-17 23:42 ` [-mm patch] arch/i386/video/fbdev.c should #include <asm/fb.h> Adrian Bunk
2007-06-18 4:52 ` Sam Ravnborg
2007-06-19 13:53 ` 2.6.22-rc4-mm2 J.A. Magallón
2007-06-19 14:34 ` 2.6.22-rc4-mm2 J.A. Magallón
2007-06-20 7:23 ` 2.6.22-rc4-mm2 Jiri Slaby
2007-06-20 21:54 ` 2.6.22-rc4-mm2 J.A. Magallón
2007-06-20 5:22 ` can't suspend on vaio sz (rc4 and rc5 are ok) [was Re: 2.6.22-rc4-mm2] Mattia Dongili
2007-06-20 11:40 ` Rafael J. Wysocki
2007-06-20 15:38 ` Mattia Dongili
2007-06-20 20:50 ` Rafael J. Wysocki
2007-06-20 22:03 ` Rafael J. Wysocki
2007-06-20 22:22 ` Rafael J. Wysocki
2007-06-21 15:28 ` Alan Stern
2007-06-21 19:39 ` Alan Stern
2007-06-21 21:49 ` Rafael J. Wysocki
2007-06-22 9:25 ` Mattia Dongili
2007-06-22 13:59 ` Alan Stern
2007-06-24 5:27 ` Mattia Dongili
2007-06-24 8:33 ` it's iwl3945 [Re: " Mattia Dongili
2007-06-20 14:01 ` [linux-usb-devel] " Alan Stern
2007-06-20 14:12 ` Rafael J. Wysocki
2007-06-21 23:52 ` [-mm patch] mark calibrate_xor_blocks() __init Adrian Bunk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070614221555.GY3588@stusta.de \
--to=bunk@stusta.de \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome