xfs_aops.c (b54ffb73cadcdcff9cc1ae0e11f502407e3e2e4c) xfs_aops.c (bee9182d955227f01ff3b80c4cb6acca9bb40b11)
1/*
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *

--- 105 unchanged lines hidden (view full) ---

114 }
115
116 ioend->io_append_trans = tp;
117
118 /*
119 * We may pass freeze protection with a transaction. So tell lockdep
120 * we released it.
121 */
1/*
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *

--- 105 unchanged lines hidden (view full) ---

114 }
115
116 ioend->io_append_trans = tp;
117
118 /*
119 * We may pass freeze protection with a transaction. So tell lockdep
120 * we released it.
121 */
122 rwsem_release(&ioend->io_inode->i_sb->s_writers.lock_map[SB_FREEZE_FS-1],
123 1, _THIS_IP_);
122 __sb_writers_release(ioend->io_inode->i_sb, SB_FREEZE_FS);
124 /*
125 * We hand off the transaction to the completion thread now, so
126 * clear the flag here.
127 */
128 current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS);
129 return 0;
130}
131

--- 34 unchanged lines hidden (view full) ---

166 struct xfs_trans *tp = ioend->io_append_trans;
167
168 /*
169 * The transaction may have been allocated in the I/O submission thread,
170 * thus we need to mark ourselves as being in a transaction manually.
171 * Similarly for freeze protection.
172 */
173 current_set_flags_nested(&tp->t_pflags, PF_FSTRANS);
123 /*
124 * We hand off the transaction to the completion thread now, so
125 * clear the flag here.
126 */
127 current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS);
128 return 0;
129}
130

--- 34 unchanged lines hidden (view full) ---

165 struct xfs_trans *tp = ioend->io_append_trans;
166
167 /*
168 * The transaction may have been allocated in the I/O submission thread,
169 * thus we need to mark ourselves as being in a transaction manually.
170 * Similarly for freeze protection.
171 */
172 current_set_flags_nested(&tp->t_pflags, PF_FSTRANS);
174 rwsem_acquire_read(&VFS_I(ip)->i_sb->s_writers.lock_map[SB_FREEZE_FS-1],
175 0, 1, _THIS_IP_);
173 __sb_writers_acquired(VFS_I(ip)->i_sb, SB_FREEZE_FS);
176
177 return xfs_setfilesize(ip, tp, ioend->io_offset, ioend->io_size);
178}
179
180/*
181 * Schedule IO completion handling on the final put of an ioend.
182 *
183 * If there is no work to do we might as well call it a day and free the

--- 162 unchanged lines hidden (view full) ---

346 offset < imap->br_startoff + imap->br_blockcount;
347}
348
349/*
350 * BIO completion handler for buffered IO.
351 */
352STATIC void
353xfs_end_bio(
174
175 return xfs_setfilesize(ip, tp, ioend->io_offset, ioend->io_size);
176}
177
178/*
179 * Schedule IO completion handling on the final put of an ioend.
180 *
181 * If there is no work to do we might as well call it a day and free the

--- 162 unchanged lines hidden (view full) ---

344 offset < imap->br_startoff + imap->br_blockcount;
345}
346
347/*
348 * BIO completion handler for buffered IO.
349 */
350STATIC void
351xfs_end_bio(
354 struct bio *bio)
352 struct bio *bio,
353 int error)
355{
356 xfs_ioend_t *ioend = bio->bi_private;
357
354{
355 xfs_ioend_t *ioend = bio->bi_private;
356
358 ioend->io_error = bio->bi_error;
357 ioend->io_error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? 0 : error;
359
360 /* Toss bio and pass work off to an xfsdatad thread */
361 bio->bi_private = NULL;
362 bio->bi_end_io = NULL;
363 bio_put(bio);
364
365 xfs_finish_ioend(ioend);
366}

--- 9 unchanged lines hidden (view full) ---

376 bio->bi_end_io = xfs_end_bio;
377 submit_bio(wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE, bio);
378}
379
380STATIC struct bio *
381xfs_alloc_ioend_bio(
382 struct buffer_head *bh)
383{
358
359 /* Toss bio and pass work off to an xfsdatad thread */
360 bio->bi_private = NULL;
361 bio->bi_end_io = NULL;
362 bio_put(bio);
363
364 xfs_finish_ioend(ioend);
365}

--- 9 unchanged lines hidden (view full) ---

375 bio->bi_end_io = xfs_end_bio;
376 submit_bio(wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE, bio);
377}
378
379STATIC struct bio *
380xfs_alloc_ioend_bio(
381 struct buffer_head *bh)
382{
384 struct bio *bio = bio_alloc(GFP_NOIO, BIO_MAX_PAGES);
383 int nvecs = bio_get_nr_vecs(bh->b_bdev);
384 struct bio *bio = bio_alloc(GFP_NOIO, nvecs);
385
386 ASSERT(bio->bi_private == NULL);
387 bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9);
388 bio->bi_bdev = bh->b_bdev;
389 return bio;
390}
391
392STATIC void

--- 1612 unchanged lines hidden ---
385
386 ASSERT(bio->bi_private == NULL);
387 bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9);
388 bio->bi_bdev = bh->b_bdev;
389 return bio;
390}
391
392STATIC void

--- 1612 unchanged lines hidden ---