diff options
| author | Linus Torvalds <torvalds@home.transmeta.com> | 2003-02-10 19:15:38 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-02-10 19:15:38 -0800 |
| commit | bd83dce2241887915da737dc275d2e243ee2fa68 (patch) | |
| tree | 57a6a28af861a0cb46dc844861c1ca627895e0b5 /fs | |
| parent | faea911147c2fe5de5ef9464aa7cb14122b58d94 (diff) | |
| parent | 83586a3d2e6b9eb24cce5b9ac20d81e1aff17370 (diff) | |
Merge bk://linux-dj.bkbits.net/watchdog
into home.transmeta.com:/home/torvalds/v2.5/linux
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/buffer.c | 24 | ||||
| -rw-r--r-- | fs/devfs/base.c | 2 | ||||
| -rw-r--r-- | fs/ext3/inode.c | 5 | ||||
| -rw-r--r-- | fs/ext3/super.c | 2 | ||||
| -rw-r--r-- | fs/jbd/journal.c | 1 | ||||
| -rw-r--r-- | fs/jbd/recovery.c | 16 | ||||
| -rw-r--r-- | fs/jbd/transaction.c | 141 |
7 files changed, 27 insertions, 164 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index b06d6ccc1966..140aad55b292 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -31,7 +31,6 @@ #include <linux/highmem.h> #include <linux/module.h> #include <linux/writeback.h> -#include <linux/mempool.h> #include <linux/hash.h> #include <linux/suspend.h> #include <linux/buffer_head.h> @@ -2791,7 +2790,6 @@ asmlinkage long sys_bdflush(int func, long data) * Buffer-head allocation */ static kmem_cache_t *bh_cachep; -static mempool_t *bh_mempool; /* * Once the number of bh's in the machine exceeds this level, we start @@ -2825,7 +2823,7 @@ static void recalc_bh_state(void) struct buffer_head *alloc_buffer_head(void) { - struct buffer_head *ret = mempool_alloc(bh_mempool, GFP_NOFS); + struct buffer_head *ret = kmem_cache_alloc(bh_cachep, GFP_NOFS); if (ret) { preempt_disable(); __get_cpu_var(bh_accounting).nr++; @@ -2839,7 +2837,7 @@ EXPORT_SYMBOL(alloc_buffer_head); void free_buffer_head(struct buffer_head *bh) { BUG_ON(!list_empty(&bh->b_assoc_buffers)); - mempool_free(bh, bh_mempool); + kmem_cache_free(bh_cachep, bh); preempt_disable(); __get_cpu_var(bh_accounting).nr--; recalc_bh_state(); @@ -2847,7 +2845,8 @@ void free_buffer_head(struct buffer_head *bh) } EXPORT_SYMBOL(free_buffer_head); -static void init_buffer_head(void *data, kmem_cache_t *cachep, unsigned long flags) +static void +init_buffer_head(void *data, kmem_cache_t *cachep, unsigned long flags) { if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == SLAB_CTOR_CONSTRUCTOR) { @@ -2858,19 +2857,6 @@ static void init_buffer_head(void *data, kmem_cache_t *cachep, unsigned long fla } } -static void *bh_mempool_alloc(int gfp_mask, void *pool_data) -{ - return kmem_cache_alloc(bh_cachep, gfp_mask); -} - -static void bh_mempool_free(void *element, void *pool_data) -{ - return kmem_cache_free(bh_cachep, element); -} - -#define NR_RESERVED (10*MAX_BUF_PER_PAGE) -#define MAX_UNUSED_BUFFERS NR_RESERVED+20 - static void buffer_init_cpu(int cpu) { struct bh_accounting *bha = &per_cpu(bh_accounting, cpu); @@ -2907,8 +2893,6 @@ void __init buffer_init(void) bh_cachep = kmem_cache_create("buffer_head", sizeof(struct buffer_head), 0, 0, init_buffer_head, NULL); - bh_mempool = mempool_create(MAX_UNUSED_BUFFERS, bh_mempool_alloc, - bh_mempool_free, NULL); for (i = 0; i < ARRAY_SIZE(bh_wait_queue_heads); i++) init_waitqueue_head(&bh_wait_queue_heads[i].wqh); diff --git a/fs/devfs/base.c b/fs/devfs/base.c index 02f6bcfc5fe2..b82077b01ec1 100644 --- a/fs/devfs/base.c +++ b/fs/devfs/base.c @@ -1169,7 +1169,7 @@ static devfs_handle_t _devfs_make_parent_for_leaf (struct devfs_entry *dir, *leaf_pos = (name[namelen] == '/') ? (namelen + 1) : 0; for (; namelen > 0; name += next_pos, namelen -= next_pos) { - struct devfs_entry *de, *old; + struct devfs_entry *de, *old = NULL; if ( ( de = _devfs_descend (dir, name, namelen, &next_pos) ) == NULL ) { diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 24897acf33da..ca17eb33b07d 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c @@ -1317,10 +1317,7 @@ static int ext3_writepage(struct page *page, struct writeback_control *wbc) goto out_fail; needed = ext3_writepage_trans_blocks(inode); - if (wbc->for_reclaim) - handle = ext3_journal_try_start(inode, needed); - else - handle = ext3_journal_start(inode, needed); + handle = ext3_journal_start(inode, needed); if (IS_ERR(handle)) { ret = PTR_ERR(handle); diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 3f92266d6f53..765ec7d043f7 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c @@ -1343,9 +1343,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) * superblock lock. */ EXT3_SB(sb)->s_mount_state |= EXT3_ORPHAN_FS; - unlock_super(sb); /* akpm: sigh */ ext3_orphan_cleanup(sb, es); - lock_super(sb); EXT3_SB(sb)->s_mount_state &= ~EXT3_ORPHAN_FS; if (needs_recovery) printk (KERN_INFO "EXT3-fs: recovery complete.\n"); diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index dd5e16f8c865..3a8be07f8c7e 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c @@ -38,7 +38,6 @@ #include <linux/proc_fs.h> EXPORT_SYMBOL(journal_start); -EXPORT_SYMBOL(journal_try_start); EXPORT_SYMBOL(journal_restart); EXPORT_SYMBOL(journal_extend); EXPORT_SYMBOL(journal_stop); diff --git a/fs/jbd/recovery.c b/fs/jbd/recovery.c index f82d7f3cc507..d9afa22f5de2 100644 --- a/fs/jbd/recovery.c +++ b/fs/jbd/recovery.c @@ -212,16 +212,14 @@ do { \ * * The primary function for recovering the log contents when mounting a * journaled device. - */ -int journal_recover(journal_t *journal) -{ -/* + * * Recovery is done in three passes. In the first pass, we look for the * end of the log. In the second, we assemble the list of revoke * blocks. In the third and final pass, we replay any un-revoked blocks * in the log. */ - +int journal_recover(journal_t *journal) +{ int err; journal_superblock_t * sb; @@ -273,15 +271,13 @@ int journal_recover(journal_t *journal) * journal structures in memory to ignore it (presumably because the * caller has evidence that it is out of date). * This function does'nt appear to be exorted.. - */ -int journal_skip_recovery(journal_t *journal) -{ -/* + * * We perform one pass over the journal to allow us to tell the user how * much recovery information is being erased, and to let us initialise * the journal transaction sequence numbers to the next unused ID. */ - +int journal_skip_recovery(journal_t *journal) +{ int err; journal_superblock_t * sb; diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index b8333d8afdfe..06d27895de7d 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c @@ -266,113 +266,6 @@ handle_t *journal_start(journal_t *journal, int nblocks) return handle; } -/* - * Return zero on success - */ -static int try_start_this_handle(journal_t *journal, handle_t *handle) -{ - transaction_t *transaction; - int needed; - int nblocks = handle->h_buffer_credits; - int ret = 0; - - jbd_debug(3, "New handle %p maybe going live.\n", handle); - - lock_journal(journal); - - if (is_journal_aborted(journal) || - (journal->j_errno != 0 && !(journal->j_flags & JFS_ACK_ERR))) { - ret = -EROFS; - goto fail_unlock; - } - - if (journal->j_barrier_count) - goto fail_unlock; - - if (!journal->j_running_transaction && get_transaction(journal, 1) == 0) - goto fail_unlock; - - transaction = journal->j_running_transaction; - if (transaction->t_state == T_LOCKED) - goto fail_unlock; - - needed = transaction->t_outstanding_credits + nblocks; - /* We could run log_start_commit here */ - if (needed > journal->j_max_transaction_buffers) - goto fail_unlock; - - needed = journal->j_max_transaction_buffers; - if (journal->j_committing_transaction) - needed += journal->j_committing_transaction-> - t_outstanding_credits; - - if (log_space_left(journal) < needed) - goto fail_unlock; - - handle->h_transaction = transaction; - transaction->t_outstanding_credits += nblocks; - transaction->t_updates++; - jbd_debug(4, "Handle %p given %d credits (total %d, free %d)\n", - handle, nblocks, transaction->t_outstanding_credits, - log_space_left(journal)); - unlock_journal(journal); - return 0; - -fail_unlock: - unlock_journal(journal); - if (ret >= 0) - ret = -1; - return ret; -} - -/** - * handle_t *journal_try_start() - Don't block, but try and get a handle - * @journal: Journal to start transaction on. - * @nblocks: number of block buffer we might modify - * - * Try to start a handle, but non-blockingly. If we weren't able - * to, return an ERR_PTR value. - */ -handle_t *journal_try_start(journal_t *journal, int nblocks) -{ - handle_t *handle = journal_current_handle(); - int err; - - if (!journal) - return ERR_PTR(-EROFS); - - if (handle) { - jbd_debug(4, "h_ref %d -> %d\n", - handle->h_ref, - handle->h_ref + 1); - J_ASSERT(handle->h_transaction->t_journal == journal); - if (is_handle_aborted(handle)) - return ERR_PTR(-EIO); - handle->h_ref++; - return handle; - } else { - jbd_debug(4, "no current transaction\n"); - } - - if (is_journal_aborted(journal)) - return ERR_PTR(-EIO); - - handle = new_handle(nblocks); - if (!handle) - return ERR_PTR(-ENOMEM); - - current->journal_info = handle; - - err = try_start_this_handle(journal, handle); - if (err < 0) { - kfree(handle); - current->journal_info = NULL; - return ERR_PTR(err); - } - - return handle; -} - /** * int journal_extend() - extend buffer credits. * @handle: handle to 'extend' @@ -969,22 +862,23 @@ out: } /** - * int journal_dirty_data() - mark a buffer as containing dirty data which needs to be flushed before we can commit the current transaction. + * int journal_dirty_data() - mark a buffer as containing dirty data which + * needs to be flushed before we can commit the + * current transaction. * @handle: transaction * @bh: bufferhead to mark * * The buffer is placed on the transaction's data list and is marked as * belonging to the transaction. * - * Returns error number or 0 on success. - */ -int journal_dirty_data (handle_t *handle, struct buffer_head *bh) -{ -/* + * Returns error number or 0 on success. + * * journal_dirty_data() can be called via page_launder->ext3_writepage * by kswapd. So it cannot block. Happily, there's nothing here * which needs lock_journal if `async' is set. */ +int journal_dirty_data (handle_t *handle, struct buffer_head *bh) +{ journal_t *journal = handle->h_transaction->t_journal; int need_brelse = 0; struct journal_head *jh; @@ -1129,23 +1023,22 @@ no_journal: * @handle: transaction to add buffer to. * @bh: buffer to mark * - * mark dirty metadata which needs to be journaled as part of the current transaction. + * mark dirty metadata which needs to be journaled as part of the current + * transaction. * * The buffer is placed on the transaction's metadata list and is marked * as belonging to the transaction. * * Returns error number or 0 on success. - */ -int journal_dirty_metadata (handle_t *handle, struct buffer_head *bh) -{ -/* + * * Special care needs to be taken if the buffer already belongs to the * current committing transaction (in which case we should have frozen * data present for that commit). In that case, we don't relink the * buffer: that only gets done when the old transaction finally * completes its commit. - * */ +int journal_dirty_metadata (handle_t *handle, struct buffer_head *bh) +{ transaction_t *transaction = handle->h_transaction; journal_t *journal = transaction->t_journal; struct journal_head *jh = bh2jh(bh); @@ -1726,13 +1619,6 @@ out: * to be called. We do this if the page is releasable by try_to_free_buffers(). * We also do it if the page has locked or dirty buffers and the caller wants * us to perform sync or async writeout. - */ -int journal_try_to_free_buffers(journal_t *journal, - struct page *page, int unused_gfp_mask) -{ -/* - * journal_try_to_free_buffers(). Try to remove all this page's buffers - * from the journal. * * This complicates JBD locking somewhat. We aren't protected by the * BKL here. We wish to remove the buffer from its committing or @@ -1752,6 +1638,9 @@ int journal_try_to_free_buffers(journal_t *journal, * cannot happen because we never reallocate freed data as metadata * while the data is part of a transaction. Yes? */ +int journal_try_to_free_buffers(journal_t *journal, + struct page *page, int unused_gfp_mask) +{ struct buffer_head *head; struct buffer_head *bh; int ret = 0; |
