Commit 369c4f54 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-linus-Jun-21-2012' of git://oss.sgi.com/xfs/xfs

Pull XFS fixes from Ben Myers:
 - Fix stale data exposure with unwritten extents
 - Fix a warning in xfs_alloc_vextent with ODEBUG
 - Fix overallocation and alignment of pages for xfs_bufs
 - Fix a cursor leak
 - Fix a log hang
 - Fix a crash related to xfs_sync_worker
 - Rename xfs log structure from struct log to struct xlog so we can use
   crash dumps effectively

* tag 'for-linus-Jun-21-2012' of git://oss.sgi.com/xfs/xfs:
  xfs: rename log structure to xlog
  xfs: shutdown xfs_sync_worker before the log
  xfs: Fix overallocation in xfs_buf_allocate_memory()
  xfs: fix allocbt cursor leak in xfs_alloc_ag_vextent_near
  xfs: check for stale inode before acquiring iflock on push
  xfs: fix debug_object WARN at xfs_alloc_vextent()
  xfs: xfs_vm_writepage clear iomap_valid when !buffer_uptodate (REV2)
parents a1163719 f7bdf03a
...@@ -1080,6 +1080,7 @@ xfs_alloc_ag_vextent_near( ...@@ -1080,6 +1080,7 @@ xfs_alloc_ag_vextent_near(
goto restart; goto restart;
} }
xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR);
trace_xfs_alloc_size_neither(args); trace_xfs_alloc_size_neither(args);
args->agbno = NULLAGBLOCK; args->agbno = NULLAGBLOCK;
return 0; return 0;
...@@ -2441,7 +2442,7 @@ xfs_alloc_vextent( ...@@ -2441,7 +2442,7 @@ xfs_alloc_vextent(
DECLARE_COMPLETION_ONSTACK(done); DECLARE_COMPLETION_ONSTACK(done);
args->done = &done; args->done = &done;
INIT_WORK(&args->work, xfs_alloc_vextent_worker); INIT_WORK_ONSTACK(&args->work, xfs_alloc_vextent_worker);
queue_work(xfs_alloc_wq, &args->work); queue_work(xfs_alloc_wq, &args->work);
wait_for_completion(&done); wait_for_completion(&done);
return args->result; return args->result;
......
...@@ -981,10 +981,15 @@ xfs_vm_writepage( ...@@ -981,10 +981,15 @@ xfs_vm_writepage(
imap_valid = 0; imap_valid = 0;
} }
} else { } else {
if (PageUptodate(page)) { if (PageUptodate(page))
ASSERT(buffer_mapped(bh)); ASSERT(buffer_mapped(bh));
imap_valid = 0; /*
} * This buffer is not uptodate and will not be
* written to disk. Ensure that we will put any
* subsequent writeable buffers into a new
* ioend.
*/
imap_valid = 0;
continue; continue;
} }
......
...@@ -201,14 +201,7 @@ xfs_buf_alloc( ...@@ -201,14 +201,7 @@ xfs_buf_alloc(
bp->b_length = numblks; bp->b_length = numblks;
bp->b_io_length = numblks; bp->b_io_length = numblks;
bp->b_flags = flags; bp->b_flags = flags;
bp->b_bn = blkno;
/*
* We do not set the block number here in the buffer because we have not
* finished initialising the buffer. We insert the buffer into the cache
* in this state, so this ensures that we are unable to do IO on a
* buffer that hasn't been fully initialised.
*/
bp->b_bn = XFS_BUF_DADDR_NULL;
atomic_set(&bp->b_pin_count, 0); atomic_set(&bp->b_pin_count, 0);
init_waitqueue_head(&bp->b_waiters); init_waitqueue_head(&bp->b_waiters);
...@@ -567,11 +560,6 @@ xfs_buf_get( ...@@ -567,11 +560,6 @@ xfs_buf_get(
if (bp != new_bp) if (bp != new_bp)
xfs_buf_free(new_bp); xfs_buf_free(new_bp);
/*
* Now we have a workable buffer, fill in the block number so
* that we can do IO on it.
*/
bp->b_bn = blkno;
bp->b_io_length = bp->b_length; bp->b_io_length = bp->b_length;
found: found:
...@@ -772,7 +760,7 @@ xfs_buf_get_uncached( ...@@ -772,7 +760,7 @@ xfs_buf_get_uncached(
int error, i; int error, i;
xfs_buf_t *bp; xfs_buf_t *bp;
bp = xfs_buf_alloc(target, 0, numblks, 0); bp = xfs_buf_alloc(target, XFS_BUF_DADDR_NULL, numblks, 0);
if (unlikely(bp == NULL)) if (unlikely(bp == NULL))
goto fail; goto fail;
......
...@@ -504,6 +504,14 @@ xfs_inode_item_push( ...@@ -504,6 +504,14 @@ xfs_inode_item_push(
goto out_unlock; goto out_unlock;
} }
/*
* Stale inode items should force out the iclog.
*/
if (ip->i_flags & XFS_ISTALE) {
rval = XFS_ITEM_PINNED;
goto out_unlock;
}
/* /*
* Someone else is already flushing the inode. Nothing we can do * Someone else is already flushing the inode. Nothing we can do
* here but wait for the flush to finish and remove the item from * here but wait for the flush to finish and remove the item from
...@@ -514,15 +522,6 @@ xfs_inode_item_push( ...@@ -514,15 +522,6 @@ xfs_inode_item_push(
goto out_unlock; goto out_unlock;
} }
/*
* Stale inode items should force out the iclog.
*/
if (ip->i_flags & XFS_ISTALE) {
xfs_ifunlock(ip);
xfs_iunlock(ip, XFS_ILOCK_SHARED);
return XFS_ITEM_PINNED;
}
ASSERT(iip->ili_fields != 0 || XFS_FORCED_SHUTDOWN(ip->i_mount)); ASSERT(iip->ili_fields != 0 || XFS_FORCED_SHUTDOWN(ip->i_mount));
ASSERT(iip->ili_logged == 0 || XFS_FORCED_SHUTDOWN(ip->i_mount)); ASSERT(iip->ili_logged == 0 || XFS_FORCED_SHUTDOWN(ip->i_mount));
......
...@@ -38,13 +38,21 @@ ...@@ -38,13 +38,21 @@
kmem_zone_t *xfs_log_ticket_zone; kmem_zone_t *xfs_log_ticket_zone;
/* Local miscellaneous function prototypes */ /* Local miscellaneous function prototypes */
STATIC int xlog_commit_record(struct log *log, struct xlog_ticket *ticket, STATIC int
xlog_in_core_t **, xfs_lsn_t *); xlog_commit_record(
struct xlog *log,
struct xlog_ticket *ticket,
struct xlog_in_core **iclog,
xfs_lsn_t *commitlsnp);
STATIC xlog_t * xlog_alloc_log(xfs_mount_t *mp, STATIC xlog_t * xlog_alloc_log(xfs_mount_t *mp,
xfs_buftarg_t *log_target, xfs_buftarg_t *log_target,
xfs_daddr_t blk_offset, xfs_daddr_t blk_offset,
int num_bblks); int num_bblks);
STATIC int xlog_space_left(struct log *log, atomic64_t *head); STATIC int
xlog_space_left(
struct xlog *log,
atomic64_t *head);
STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog); STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog);
STATIC void xlog_dealloc_log(xlog_t *log); STATIC void xlog_dealloc_log(xlog_t *log);
...@@ -64,8 +72,10 @@ STATIC void xlog_state_switch_iclogs(xlog_t *log, ...@@ -64,8 +72,10 @@ STATIC void xlog_state_switch_iclogs(xlog_t *log,
int eventual_size); int eventual_size);
STATIC void xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog); STATIC void xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog);
STATIC void xlog_grant_push_ail(struct log *log, STATIC void
int need_bytes); xlog_grant_push_ail(
struct xlog *log,
int need_bytes);
STATIC void xlog_regrant_reserve_log_space(xlog_t *log, STATIC void xlog_regrant_reserve_log_space(xlog_t *log,
xlog_ticket_t *ticket); xlog_ticket_t *ticket);
STATIC void xlog_ungrant_log_space(xlog_t *log, STATIC void xlog_ungrant_log_space(xlog_t *log,
...@@ -73,7 +83,9 @@ STATIC void xlog_ungrant_log_space(xlog_t *log, ...@@ -73,7 +83,9 @@ STATIC void xlog_ungrant_log_space(xlog_t *log,
#if defined(DEBUG) #if defined(DEBUG)
STATIC void xlog_verify_dest_ptr(xlog_t *log, char *ptr); STATIC void xlog_verify_dest_ptr(xlog_t *log, char *ptr);
STATIC void xlog_verify_grant_tail(struct log *log); STATIC void
xlog_verify_grant_tail(
struct xlog *log);
STATIC void xlog_verify_iclog(xlog_t *log, xlog_in_core_t *iclog, STATIC void xlog_verify_iclog(xlog_t *log, xlog_in_core_t *iclog,
int count, boolean_t syncing); int count, boolean_t syncing);
STATIC void xlog_verify_tail_lsn(xlog_t *log, xlog_in_core_t *iclog, STATIC void xlog_verify_tail_lsn(xlog_t *log, xlog_in_core_t *iclog,
...@@ -89,9 +101,9 @@ STATIC int xlog_iclogs_empty(xlog_t *log); ...@@ -89,9 +101,9 @@ STATIC int xlog_iclogs_empty(xlog_t *log);
static void static void
xlog_grant_sub_space( xlog_grant_sub_space(
struct log *log, struct xlog *log,
atomic64_t *head, atomic64_t *head,
int bytes) int bytes)
{ {
int64_t head_val = atomic64_read(head); int64_t head_val = atomic64_read(head);
int64_t new, old; int64_t new, old;
...@@ -115,9 +127,9 @@ xlog_grant_sub_space( ...@@ -115,9 +127,9 @@ xlog_grant_sub_space(
static void static void
xlog_grant_add_space( xlog_grant_add_space(
struct log *log, struct xlog *log,
atomic64_t *head, atomic64_t *head,
int bytes) int bytes)
{ {
int64_t head_val = atomic64_read(head); int64_t head_val = atomic64_read(head);
int64_t new, old; int64_t new, old;
...@@ -165,7 +177,7 @@ xlog_grant_head_wake_all( ...@@ -165,7 +177,7 @@ xlog_grant_head_wake_all(
static inline int static inline int
xlog_ticket_reservation( xlog_ticket_reservation(
struct log *log, struct xlog *log,
struct xlog_grant_head *head, struct xlog_grant_head *head,
struct xlog_ticket *tic) struct xlog_ticket *tic)
{ {
...@@ -182,7 +194,7 @@ xlog_ticket_reservation( ...@@ -182,7 +194,7 @@ xlog_ticket_reservation(
STATIC bool STATIC bool
xlog_grant_head_wake( xlog_grant_head_wake(
struct log *log, struct xlog *log,
struct xlog_grant_head *head, struct xlog_grant_head *head,
int *free_bytes) int *free_bytes)
{ {
...@@ -204,7 +216,7 @@ xlog_grant_head_wake( ...@@ -204,7 +216,7 @@ xlog_grant_head_wake(
STATIC int STATIC int
xlog_grant_head_wait( xlog_grant_head_wait(
struct log *log, struct xlog *log,
struct xlog_grant_head *head, struct xlog_grant_head *head,
struct xlog_ticket *tic, struct xlog_ticket *tic,
int need_bytes) int need_bytes)
...@@ -256,7 +268,7 @@ xlog_grant_head_wait( ...@@ -256,7 +268,7 @@ xlog_grant_head_wait(
*/ */
STATIC int STATIC int
xlog_grant_head_check( xlog_grant_head_check(
struct log *log, struct xlog *log,
struct xlog_grant_head *head, struct xlog_grant_head *head,
struct xlog_ticket *tic, struct xlog_ticket *tic,
int *need_bytes) int *need_bytes)
...@@ -323,7 +335,7 @@ xfs_log_regrant( ...@@ -323,7 +335,7 @@ xfs_log_regrant(
struct xfs_mount *mp, struct xfs_mount *mp,
struct xlog_ticket *tic) struct xlog_ticket *tic)
{ {
struct log *log = mp->m_log; struct xlog *log = mp->m_log;
int need_bytes; int need_bytes;
int error = 0; int error = 0;
...@@ -389,7 +401,7 @@ xfs_log_reserve( ...@@ -389,7 +401,7 @@ xfs_log_reserve(
bool permanent, bool permanent,
uint t_type) uint t_type)
{ {
struct log *log = mp->m_log; struct xlog *log = mp->m_log;
struct xlog_ticket *tic; struct xlog_ticket *tic;
int need_bytes; int need_bytes;
int error = 0; int error = 0;
...@@ -465,7 +477,7 @@ xfs_log_done( ...@@ -465,7 +477,7 @@ xfs_log_done(
struct xlog_in_core **iclog, struct xlog_in_core **iclog,
uint flags) uint flags)
{ {
struct log *log = mp->m_log; struct xlog *log = mp->m_log;
xfs_lsn_t lsn = 0; xfs_lsn_t lsn = 0;
if (XLOG_FORCED_SHUTDOWN(log) || if (XLOG_FORCED_SHUTDOWN(log) ||
...@@ -810,6 +822,7 @@ xfs_log_unmount_write(xfs_mount_t *mp) ...@@ -810,6 +822,7 @@ xfs_log_unmount_write(xfs_mount_t *mp)
void void
xfs_log_unmount(xfs_mount_t *mp) xfs_log_unmount(xfs_mount_t *mp)
{ {
cancel_delayed_work_sync(&mp->m_sync_work);
xfs_trans_ail_destroy(mp); xfs_trans_ail_destroy(mp);
xlog_dealloc_log(mp->m_log); xlog_dealloc_log(mp->m_log);
} }
...@@ -838,7 +851,7 @@ void ...@@ -838,7 +851,7 @@ void
xfs_log_space_wake( xfs_log_space_wake(
struct xfs_mount *mp) struct xfs_mount *mp)
{ {
struct log *log = mp->m_log; struct xlog *log = mp->m_log;
int free_bytes; int free_bytes;
if (XLOG_FORCED_SHUTDOWN(log)) if (XLOG_FORCED_SHUTDOWN(log))
...@@ -916,7 +929,7 @@ xfs_lsn_t ...@@ -916,7 +929,7 @@ xfs_lsn_t
xlog_assign_tail_lsn_locked( xlog_assign_tail_lsn_locked(
struct xfs_mount *mp) struct xfs_mount *mp)
{ {
struct log *log = mp->m_log; struct xlog *log = mp->m_log;
struct xfs_log_item *lip; struct xfs_log_item *lip;
xfs_lsn_t tail_lsn; xfs_lsn_t tail_lsn;
...@@ -965,7 +978,7 @@ xlog_assign_tail_lsn( ...@@ -965,7 +978,7 @@ xlog_assign_tail_lsn(
*/ */
STATIC int STATIC int
xlog_space_left( xlog_space_left(
struct log *log, struct xlog *log,
atomic64_t *head) atomic64_t *head)
{ {
int free_bytes; int free_bytes;
...@@ -1277,7 +1290,7 @@ xlog_alloc_log(xfs_mount_t *mp, ...@@ -1277,7 +1290,7 @@ xlog_alloc_log(xfs_mount_t *mp,
*/ */
STATIC int STATIC int
xlog_commit_record( xlog_commit_record(
struct log *log, struct xlog *log,
struct xlog_ticket *ticket, struct xlog_ticket *ticket,
struct xlog_in_core **iclog, struct xlog_in_core **iclog,
xfs_lsn_t *commitlsnp) xfs_lsn_t *commitlsnp)
...@@ -1311,7 +1324,7 @@ xlog_commit_record( ...@@ -1311,7 +1324,7 @@ xlog_commit_record(
*/ */
STATIC void STATIC void
xlog_grant_push_ail( xlog_grant_push_ail(
struct log *log, struct xlog *log,
int need_bytes) int need_bytes)
{ {
xfs_lsn_t threshold_lsn = 0; xfs_lsn_t threshold_lsn = 0;
...@@ -1790,7 +1803,7 @@ xlog_write_start_rec( ...@@ -1790,7 +1803,7 @@ xlog_write_start_rec(
static xlog_op_header_t * static xlog_op_header_t *
xlog_write_setup_ophdr( xlog_write_setup_ophdr(
struct log *log, struct xlog *log,
struct xlog_op_header *ophdr, struct xlog_op_header *ophdr,
struct xlog_ticket *ticket, struct xlog_ticket *ticket,
uint flags) uint flags)
...@@ -1873,7 +1886,7 @@ xlog_write_setup_copy( ...@@ -1873,7 +1886,7 @@ xlog_write_setup_copy(
static int static int
xlog_write_copy_finish( xlog_write_copy_finish(
struct log *log, struct xlog *log,
struct xlog_in_core *iclog, struct xlog_in_core *iclog,
uint flags, uint flags,
int *record_cnt, int *record_cnt,
...@@ -1958,7 +1971,7 @@ xlog_write_copy_finish( ...@@ -1958,7 +1971,7 @@ xlog_write_copy_finish(
*/ */
int int
xlog_write( xlog_write(
struct log *log, struct xlog *log,
struct xfs_log_vec *log_vector, struct xfs_log_vec *log_vector,
struct xlog_ticket *ticket, struct xlog_ticket *ticket,
xfs_lsn_t *start_lsn, xfs_lsn_t *start_lsn,
...@@ -2821,7 +2834,7 @@ _xfs_log_force( ...@@ -2821,7 +2834,7 @@ _xfs_log_force(
uint flags, uint flags,
int *log_flushed) int *log_flushed)
{ {
struct log *log = mp->m_log; struct xlog *log = mp->m_log;
struct xlog_in_core *iclog; struct xlog_in_core *iclog;
xfs_lsn_t lsn; xfs_lsn_t lsn;
...@@ -2969,7 +2982,7 @@ _xfs_log_force_lsn( ...@@ -2969,7 +2982,7 @@ _xfs_log_force_lsn(
uint flags, uint flags,
int *log_flushed) int *log_flushed)
{ {
struct log *log = mp->m_log; struct xlog *log = mp->m_log;
struct xlog_in_core *iclog; struct xlog_in_core *iclog;
int already_slept = 0; int already_slept = 0;
...@@ -3147,7 +3160,7 @@ xfs_log_ticket_get( ...@@ -3147,7 +3160,7 @@ xfs_log_ticket_get(
*/ */
xlog_ticket_t * xlog_ticket_t *
xlog_ticket_alloc( xlog_ticket_alloc(
struct log *log, struct xlog *log,
int unit_bytes, int unit_bytes,
int cnt, int cnt,
char client, char client,
...@@ -3278,7 +3291,7 @@ xlog_ticket_alloc( ...@@ -3278,7 +3291,7 @@ xlog_ticket_alloc(
*/ */
void void
xlog_verify_dest_ptr( xlog_verify_dest_ptr(
struct log *log, struct xlog *log,
char *ptr) char *ptr)
{ {
int i; int i;
...@@ -3307,7 +3320,7 @@ xlog_verify_dest_ptr( ...@@ -3307,7 +3320,7 @@ xlog_verify_dest_ptr(
*/ */
STATIC void STATIC void
xlog_verify_grant_tail( xlog_verify_grant_tail(
struct log *log) struct xlog *log)
{ {
int tail_cycle, tail_blocks; int tail_cycle, tail_blocks;
int cycle, space; int cycle, space;
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
*/ */
static struct xlog_ticket * static struct xlog_ticket *
xlog_cil_ticket_alloc( xlog_cil_ticket_alloc(
struct log *log) struct xlog *log)
{ {
struct xlog_ticket *tic; struct xlog_ticket *tic;
...@@ -72,7 +72,7 @@ xlog_cil_ticket_alloc( ...@@ -72,7 +72,7 @@ xlog_cil_ticket_alloc(
*/ */
void void
xlog_cil_init_post_recovery( xlog_cil_init_post_recovery(
struct log *log) struct xlog *log)
{ {
log->l_cilp->xc_ctx->ticket = xlog_cil_ticket_alloc(log); log->l_cilp->xc_ctx->ticket = xlog_cil_ticket_alloc(log);
log->l_cilp->xc_ctx->sequence = 1; log->l_cilp->xc_ctx->sequence = 1;
...@@ -182,7 +182,7 @@ xlog_cil_prepare_log_vecs( ...@@ -182,7 +182,7 @@ xlog_cil_prepare_log_vecs(
*/ */
STATIC void STATIC void
xfs_cil_prepare_item( xfs_cil_prepare_item(
struct log *log, struct xlog *log,
struct xfs_log_vec *lv, struct xfs_log_vec *lv,
int *len, int *len,
int *diff_iovecs) int *diff_iovecs)
...@@ -231,7 +231,7 @@ xfs_cil_prepare_item( ...@@ -231,7 +231,7 @@ xfs_cil_prepare_item(
*/ */
static void static void
xlog_cil_insert_items( xlog_cil_insert_items(
struct log *log, struct xlog *log,
struct xfs_log_vec *log_vector, struct xfs_log_vec *log_vector,
struct xlog_ticket *ticket) struct xlog_ticket *ticket)
{ {
...@@ -373,7 +373,7 @@ xlog_cil_committed( ...@@ -373,7 +373,7 @@ xlog_cil_committed(
*/ */
STATIC int STATIC int
xlog_cil_push( xlog_cil_push(
struct log *log) struct xlog *log)
{ {
struct xfs_cil *cil = log->l_cilp; struct xfs_cil *cil = log->l_cilp;
struct xfs_log_vec *lv; struct xfs_log_vec *lv;
...@@ -601,7 +601,7 @@ xlog_cil_push_work( ...@@ -601,7 +601,7 @@ xlog_cil_push_work(
*/ */
static void static void
xlog_cil_push_background( xlog_cil_push_background(
struct log *log) struct xlog *log)
{ {
struct xfs_cil *cil = log->l_cilp; struct xfs_cil *cil = log->l_cilp;
...@@ -629,7 +629,7 @@ xlog_cil_push_background( ...@@ -629,7 +629,7 @@ xlog_cil_push_background(
static void static void
xlog_cil_push_foreground( xlog_cil_push_foreground(
struct log *log, struct xlog *log,
xfs_lsn_t push_seq) xfs_lsn_t push_seq)
{ {
struct xfs_cil *cil = log->l_cilp; struct xfs_cil *cil = log->l_cilp;
...@@ -683,7 +683,7 @@ xfs_log_commit_cil( ...@@ -683,7 +683,7 @@ xfs_log_commit_cil(
xfs_lsn_t *commit_lsn, xfs_lsn_t *commit_lsn,
int flags) int flags)
{ {
struct log *log = mp->m_log; struct xlog *log = mp->m_log;
int log_flags = 0; int log_flags = 0;
struct xfs_log_vec *log_vector; struct xfs_log_vec *log_vector;
...@@ -754,7 +754,7 @@ xfs_log_commit_cil( ...@@ -754,7 +754,7 @@ xfs_log_commit_cil(
*/ */
xfs_lsn_t xfs_lsn_t
xlog_cil_force_lsn( xlog_cil_force_lsn(
struct log *log, struct xlog *log,
xfs_lsn_t sequence) xfs_lsn_t sequence)
{ {
struct xfs_cil *cil = log->l_cilp; struct xfs_cil *cil = log->l_cilp;
...@@ -833,7 +833,7 @@ xfs_log_item_in_current_chkpt( ...@@ -833,7 +833,7 @@ xfs_log_item_in_current_chkpt(
*/ */
int int
xlog_cil_init( xlog_cil_init(
struct log *log) struct xlog *log)
{ {
struct xfs_cil *cil; struct xfs_cil *cil;
struct xfs_cil_ctx *ctx; struct xfs_cil_ctx *ctx;
...@@ -869,7 +869,7 @@ xlog_cil_init( ...@@ -869,7 +869,7 @@ xlog_cil_init(
void void
xlog_cil_destroy( xlog_cil_destroy(
struct log *log) struct xlog *log)
{ {
if (log->l_cilp->xc_ctx) { if (log->l_cilp->xc_ctx) {
if (log->l_cilp->xc_ctx->ticket) if (log->l_cilp->xc_ctx->ticket)
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#define __XFS_LOG_PRIV_H__ #define __XFS_LOG_PRIV_H__
struct xfs_buf; struct xfs_buf;
struct log; struct xlog;
struct xlog_ticket; struct xlog_ticket;
struct xfs_mount; struct xfs_mount;
...@@ -352,7 +352,7 @@ typedef struct xlog_in_core { ...@@ -352,7 +352,7 @@ typedef struct xlog_in_core {
struct xlog_in_core *ic_next; struct xlog_in_core *ic_next;
struct xlog_in_core *ic_prev; struct xlog_in_core *ic_prev;
struct xfs_buf *ic_bp; struct xfs_buf *ic_bp;
struct log *ic_log; struct xlog *ic_log;
int ic_size; int ic_size;
int ic_offset; int ic_offset;
int ic_bwritecnt; int ic_bwritecnt;
...@@ -409,7 +409,7 @@ struct xfs_cil_ctx { ...@@ -409,7 +409,7 @@ struct xfs_cil_ctx {
* operations almost as efficient as the old logging methods. * operations almost as efficient as the old logging methods.
*/ */
struct xfs_cil { struct xfs_cil {
struct log *xc_log; struct xlog *xc_log;
struct list_head xc_cil; struct list_head xc_cil;
spinlock_t xc_cil_lock; spinlock_t xc_cil_lock;
struct xfs_cil_ctx *xc_ctx; struct xfs_cil_ctx *xc_ctx;
...@@ -487,7 +487,7 @@ struct xlog_grant_head { ...@@ -487,7 +487,7 @@ struct xlog_grant_head {
* overflow 31 bits worth of byte offset, so using a byte number will mean * overflow 31 bits worth of byte offset, so using a byte number will mean
* that round off problems won't occur when releasing partial reservations. * that round off problems won't occur when releasing partial reservations.
*/ */
typedef struct log { typedef struct xlog {
/* The following fields don't need locking */ /* The following fields don't need locking */
struct xfs_mount *l_mp; /* mount point */ struct xfs_mount *l_mp; /* mount point */
struct xfs_ail *l_ailp; /* AIL log is working with */ struct xfs_ail *l_ailp; /* AIL log is working with */
...@@ -553,9 +553,14 @@ extern int xlog_recover_finish(xlog_t *log); ...@@ -553,9 +553,14 @@ extern int xlog_recover_finish(xlog_t *log);
extern void xlog_pack_data(xlog_t *log, xlog_in_core_t *iclog, int); extern void xlog_pack_data(xlog_t *log, xlog_in_core_t *iclog, int);
extern kmem_zone_t *xfs_log_ticket_zone; extern kmem_zone_t *xfs_log_ticket_zone;
struct xlog_ticket *xlog_ticket_alloc(struct log *log, int unit_bytes, struct xlog_ticket *
int count, char client, bool permanent, xlog_ticket_alloc(
xfs_km_flags_t alloc_flags); struct xlog *log,
int unit_bytes,
int count,
char client,
bool permanent,
xfs_km_flags_t alloc_flags);
static inline void static inline void
...@@ -567,9 +572,14 @@ xlog_write_adv_cnt(void **ptr, int *len, int *off, size_t bytes) ...@@ -567,9 +572,14 @@ xlog_write_adv_cnt(void **ptr, int *len, int *off, size_t bytes)
} }
void xlog_print_tic_res(struct xfs_mount *mp, struct xlog_ticket *ticket); void xlog_print_tic_res(struct xfs_mount *mp, struct xlog_ticket *ticket);
int xlog_write(struct log *log, struct xfs_log_vec *log_vector, int
struct xlog_ticket *tic, xfs_lsn_t *start_lsn, xlog_write(
xlog_in_core_t **commit_iclog, uint flags); struct xlog *log,
struct xfs_log_vec *log_vector,
struct xlog_ticket *tic,
xfs_lsn_t *start_lsn,
struct xlog_in_core **commit_iclog,
uint flags);
/* /*
* When we crack an atomic LSN, we sample it first so that the value will not * When we crack an atomic LSN, we sample it first so that the value will not
...@@ -629,17 +639,23 @@ xlog_assign_grant_head(atomic64_t *head, int cycle, int space) ...@@ -629,17 +639,23 @@ xlog_assign_grant_head(atomic64_t *head, int cycle, int space)
/* /*
* Committed Item List interfaces * Committed Item List interfaces
*/ */
int xlog_cil_init(struct log *log); int
void xlog_cil_init_post_recovery(struct log *log); xlog_cil_init(struct xlog *log);
void xlog_cil_destroy(struct log *log); void
xlog_cil_init_post_recovery(struct xlog *log);
void
xlog_cil_destroy(struct xlog *log);
/* /*
* CIL force routines * CIL force routines
*/ */
xfs_lsn_t xlog_cil_force_lsn(struct log *log, xfs_lsn_t sequence); xfs_lsn_t
xlog_cil_force_lsn(
struct xlog *log,
xfs_lsn_t sequence);
static inline void static inline void
xlog_cil_force(struct log *log) xlog_cil_force(struct xlog *log)
{ {
xlog_cil_force_lsn(log, log->l_cilp->xc_current_sequence); xlog_cil_force_lsn(log, log->l_cilp->xc_current_sequence);
} }
......
...@@ -1471,8 +1471,8 @@ xlog_recover_add_item( ...@@ -1471,8 +1471,8 @@ xlog_recover_add_item(
STATIC int STATIC int
xlog_recover_add_to_cont_trans( xlog_recover_add_to_cont_trans(
struct log *log, struct xlog *log,
xlog_recover_t *trans, struct xlog_recover *trans,
xfs_caddr_t dp, xfs_caddr_t dp,
int len) int len)
{ {
...@@ -1517,8 +1517,8 @@ xlog_recover_add_to_cont_trans( ...@@ -1517,8 +1517,8 @@ xlog_recover_add_to_cont_trans(
*/ */
STATIC int STATIC int
xlog_recover_add_to_trans( xlog_recover_add_to_trans(
struct log *log, struct xlog *log,
xlog_recover_t *trans, struct xlog_recover *trans,
xfs_caddr_t dp, xfs_caddr_t dp,
int len) int len)
{ {
...@@ -1588,8 +1588,8 @@ xlog_recover_add_to_trans( ...@@ -1588,8 +1588,8 @@ xlog_recover_add_to_trans(
*/ */
STATIC int STATIC int
xlog_recover_reorder_trans( xlog_recover_reorder_trans(
struct log *log, struct xlog *log,
xlog_recover_t *trans, struct xlog_recover *trans,
int pass) int pass)
{ {
xlog_recover_item_t *item, *n; xlog_recover_item_t *item, *n;
...@@ -1642,8 +1642,8 @@ xlog_recover_reorder_trans( ...@@ -1642,8 +1642,8 @@ xlog_recover_reorder_trans(
*/ */
STATIC int STATIC int
xlog_recover_buffer_pass1( xlog_recover_buffer_pass1(
struct log *log, struct xlog *log,
xlog_recover_item_t *item) struct xlog_recover_item *item)
{ {
xfs_buf_log_format_t *buf_f = item->ri_buf[0].i_addr; xfs_buf_log_format_t *buf_f = item->ri_buf[0].i_addr;
struct list_head *bucket; struct list_head *bucket;
...@@ -1696,7 +1696,7 @@ xlog_recover_buffer_pass1( ...@@ -1696,7 +1696,7 @@ xlog_recover_buffer_pass1(
*/ */
STATIC int STATIC int
xlog_check_buffer_cancelled( xlog_check_buffer_cancelled(
struct log *log, struct xlog *log,
xfs_daddr_t blkno, xfs_daddr_t blkno,
uint len, uint len,
ushort flags) ushort flags)
...@@ -2689,9 +2689,9 @@ xlog_recover_free_trans( ...@@ -2689,9 +2689,9 @@ xlog_recover_free_trans(
STATIC int STATIC int
xlog_recover_commit_pass1( xlog_recover_commit_pass1(
struct log *log, struct xlog *log,
struct xlog_recover *trans, struct xlog_recover *trans,
xlog_recover_item_t *item) struct xlog_recover_item *item)
{ {
trace_xfs_log_recover_item_recover(log, trans, item, XLOG_RECOVER_PASS1); trace_xfs_log_recover_item_recover(log, trans, item, XLOG_RECOVER_PASS1);
...@@ -2716,10 +2716,10 @@ xlog_recover_commit_pass1( ...@@ -2716,10 +2716,10 @@ xlog_recover_commit_pass1(
STATIC int STATIC int
xlog_recover_commit_pass2( xlog_recover_commit_pass2(
struct log *log, struct xlog *log,
struct xlog_recover *trans, struct xlog_recover *trans,
struct list_head *buffer_list, struct list_head *buffer_list,
xlog_recover_item_t *item) struct xlog_recover_item *item)
{ {
trace_xfs_log_recover_item_recover(log, trans, item, XLOG_RECOVER_PASS2); trace_xfs_log_recover_item_recover(log, trans, item, XLOG_RECOVER_PASS2);
...@@ -2753,7 +2753,7 @@ xlog_recover_commit_pass2( ...@@ -2753,7 +2753,7 @@ xlog_recover_commit_pass2(
*/ */
STATIC int STATIC int
xlog_recover_commit_trans( xlog_recover_commit_trans(
struct log *log, struct xlog *log,
struct xlog_recover *trans, struct xlog_recover *trans,
int pass) int pass)
{ {
...@@ -2793,8 +2793,8 @@ xlog_recover_commit_trans( ...@@ -2793,8 +2793,8 @@ xlog_recover_commit_trans(
STATIC int STATIC int
xlog_recover_unmount_trans( xlog_recover_unmount_trans(
struct log *log, struct xlog *log,
xlog_recover_t *trans) struct xlog_recover *trans)
{ {
/* Do nothing now */ /* Do nothing now */
xfs_warn(log->l_mp, "%s: Unmount LR", __func__); xfs_warn(log->l_mp, "%s: Unmount LR", __func__);
......
...@@ -53,7 +53,7 @@ typedef struct xfs_trans_reservations { ...@@ -53,7 +53,7 @@ typedef struct xfs_trans_reservations {
#include "xfs_sync.h" #include "xfs_sync.h"
struct log; struct xlog;
struct xfs_mount_args; struct xfs_mount_args;
struct xfs_inode; struct xfs_inode;
struct xfs_bmbt_irec; struct xfs_bmbt_irec;
...@@ -133,7 +133,7 @@ typedef struct xfs_mount { ...@@ -133,7 +133,7 @@ typedef struct xfs_mount {
uint m_readio_blocks; /* min read size blocks */ uint m_readio_blocks; /* min read size blocks */
uint m_writeio_log; /* min write size log bytes */ uint m_writeio_log; /* min write size log bytes */
uint m_writeio_blocks; /* min write size blocks */ uint m_writeio_blocks; /* min write size blocks */
struct log *m_log; /* log specific stuff */ struct xlog *m_log; /* log specific stuff */
int m_logbufs; /* number of log buffers */ int m_logbufs; /* number of log buffers */
int m_logbsize; /* size of each log buffer */ int m_logbsize; /* size of each log buffer */
uint m_rsumlevels; /* rt summary levels */ uint m_rsumlevels; /* rt summary levels */
......
...@@ -386,23 +386,23 @@ xfs_sync_worker( ...@@ -386,23 +386,23 @@ xfs_sync_worker(
* We shouldn't write/force the log if we are in the mount/unmount * We shouldn't write/force the log if we are in the mount/unmount
* process or on a read only filesystem. The workqueue still needs to be * process or on a read only filesystem. The workqueue still needs to be
* active in both cases, however, because it is used for inode reclaim * active in both cases, however, because it is used for inode reclaim
* during these times. Use the s_umount semaphore to provide exclusion * during these times. Use the MS_ACTIVE flag to avoid doing anything
* with unmount. * during mount. Doing work during unmount is avoided by calling
* cancel_delayed_work_sync on this work queue before tearing down
* the ail and the log in xfs_log_unmount.
*/ */
if (down_read_trylock(&mp->m_super->s_umount)) { if (!(mp->m_super->s_flags & MS_ACTIVE) &&
if (!(mp->m_flags & XFS_MOUNT_RDONLY)) { !(mp->m_flags & XFS_MOUNT_RDONLY)) {
/* dgc: errors ignored here */ /* dgc: errors ignored here */
if (mp->m_super->s_frozen == SB_UNFROZEN && if (mp->m_super->s_frozen == SB_UNFROZEN &&
xfs_log_need_covered(mp)) xfs_log_need_covered(mp))
error = xfs_fs_log_dummy(mp); error = xfs_fs_log_dummy(mp);
else else
xfs_log_force(mp, 0); xfs_log_force(mp, 0);
/* start pushing all the metadata that is currently /* start pushing all the metadata that is currently
* dirty */ * dirty */
xfs_ail_push_all(mp->m_ail); xfs_ail_push_all(mp->m_ail);
}
up_read(&mp->m_super->s_umount);
} }
/* queue us up again */ /* queue us up again */
......
...@@ -32,7 +32,7 @@ struct xfs_da_node_entry; ...@@ -32,7 +32,7 @@ struct xfs_da_node_entry;
struct xfs_dquot; struct xfs_dquot;
struct xfs_log_item; struct xfs_log_item;
struct xlog_ticket; struct xlog_ticket;
struct log; struct xlog;
struct xlog_recover; struct xlog_recover;
struct xlog_recover_item; struct xlog_recover_item;
struct xfs_buf_log_format; struct xfs_buf_log_format;
...@@ -762,7 +762,7 @@ DEFINE_DQUOT_EVENT(xfs_dqflush_force); ...@@ -762,7 +762,7 @@ DEFINE_DQUOT_EVENT(xfs_dqflush_force);
DEFINE_DQUOT_EVENT(xfs_dqflush_done); DEFINE_DQUOT_EVENT(xfs_dqflush_done);
DECLARE_EVENT_CLASS(xfs_loggrant_class, DECLARE_EVENT_CLASS(xfs_loggrant_class,
TP_PROTO(struct log *log, struct xlog_ticket *tic), TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
TP_ARGS(log, tic), TP_ARGS(log, tic),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(dev_t, dev) __field(dev_t, dev)
...@@ -830,7 +830,7 @@ DECLARE_EVENT_CLASS(xfs_loggrant_class, ...@@ -830,7 +830,7 @@ DECLARE_EVENT_CLASS(xfs_loggrant_class,
#define DEFINE_LOGGRANT_EVENT(name) \ #define DEFINE_LOGGRANT_EVENT(name) \
DEFINE_EVENT(xfs_loggrant_class, name, \ DEFINE_EVENT(xfs_loggrant_class, name, \
TP_PROTO(struct log *log, struct xlog_ticket *tic), \ TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
TP_ARGS(log, tic)) TP_ARGS(log, tic))
DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm); DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
DEFINE_LOGGRANT_EVENT(xfs_log_done_perm); DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
...@@ -1664,7 +1664,7 @@ DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before); ...@@ -1664,7 +1664,7 @@ DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after); DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
DECLARE_EVENT_CLASS(xfs_log_recover_item_class, DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
TP_PROTO(struct log *log, struct xlog_recover *trans, TP_PROTO(struct xlog *log, struct xlog_recover *trans,
struct xlog_recover_item *item, int pass), struct xlog_recover_item *item, int pass),
TP_ARGS(log, trans, item, pass), TP_ARGS(log, trans, item, pass),
TP_STRUCT__entry( TP_STRUCT__entry(
...@@ -1698,7 +1698,7 @@ DECLARE_EVENT_CLASS(xfs_log_recover_item_class, ...@@ -1698,7 +1698,7 @@ DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
#define DEFINE_LOG_RECOVER_ITEM(name) \ #define DEFINE_LOG_RECOVER_ITEM(name) \
DEFINE_EVENT(xfs_log_recover_item_class, name, \ DEFINE_EVENT(xfs_log_recover_item_class, name, \
TP_PROTO(struct log *log, struct xlog_recover *trans, \ TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
struct xlog_recover_item *item, int pass), \ struct xlog_recover_item *item, int pass), \
TP_ARGS(log, trans, item, pass)) TP_ARGS(log, trans, item, pass))
...@@ -1709,7 +1709,7 @@ DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail); ...@@ -1709,7 +1709,7 @@ DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover); DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class, DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
TP_PROTO(struct log *log, struct xfs_buf_log_format *buf_f), TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
TP_ARGS(log, buf_f), TP_ARGS(log, buf_f),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(dev_t, dev) __field(dev_t, dev)
...@@ -1739,7 +1739,7 @@ DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class, ...@@ -1739,7 +1739,7 @@ DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \ #define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \ DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
TP_PROTO(struct log *log, struct xfs_buf_log_format *buf_f), \ TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
TP_ARGS(log, buf_f)) TP_ARGS(log, buf_f))
DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel); DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
...@@ -1752,7 +1752,7 @@ DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf); ...@@ -1752,7 +1752,7 @@ DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf); DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class, DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
TP_PROTO(struct log *log, struct xfs_inode_log_format *in_f), TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
TP_ARGS(log, in_f), TP_ARGS(log, in_f),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(dev_t, dev) __field(dev_t, dev)
...@@ -1790,7 +1790,7 @@ DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class, ...@@ -1790,7 +1790,7 @@ DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
) )
#define DEFINE_LOG_RECOVER_INO_ITEM(name) \ #define DEFINE_LOG_RECOVER_INO_ITEM(name) \
DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \ DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
TP_PROTO(struct log *log, struct xfs_inode_log_format *in_f), \ TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
TP_ARGS(log, in_f)) TP_ARGS(log, in_f))
DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover); DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
......
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