Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
75e58ce4
Commit
75e58ce4
authored
Oct 02, 2014
by
Dave Chinner
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'xfs-buf-iosubmit' into for-next
parents
bd438f82
8c156125
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
282 additions
and
358 deletions
+282
-358
fs/xfs/xfs_bmap_util.c
fs/xfs/xfs_bmap_util.c
+15
-41
fs/xfs/xfs_buf.c
fs/xfs/xfs_buf.c
+177
-176
fs/xfs/xfs_buf.h
fs/xfs/xfs_buf.h
+7
-8
fs/xfs/xfs_buf_item.c
fs/xfs/xfs_buf_item.c
+4
-4
fs/xfs/xfs_fsops.c
fs/xfs/xfs_fsops.c
+3
-8
fs/xfs/xfs_inode.c
fs/xfs/xfs_inode.c
+1
-1
fs/xfs/xfs_log.c
fs/xfs/xfs_log.c
+19
-40
fs/xfs/xfs_log_recover.c
fs/xfs/xfs_log_recover.c
+13
-19
fs/xfs/xfs_mount.c
fs/xfs/xfs_mount.c
+26
-29
fs/xfs/xfs_rtalloc.c
fs/xfs/xfs_rtalloc.c
+12
-18
fs/xfs/xfs_trace.h
fs/xfs/xfs_trace.h
+2
-1
fs/xfs/xfs_trans_buf.c
fs/xfs/xfs_trans_buf.c
+3
-13
No files found.
fs/xfs/xfs_bmap_util.c
View file @
75e58ce4
...
@@ -1122,14 +1122,6 @@ xfs_zero_remaining_bytes(
...
@@ -1122,14 +1122,6 @@ xfs_zero_remaining_bytes(
if
(
endoff
>
XFS_ISIZE
(
ip
))
if
(
endoff
>
XFS_ISIZE
(
ip
))
endoff
=
XFS_ISIZE
(
ip
);
endoff
=
XFS_ISIZE
(
ip
);
bp
=
xfs_buf_get_uncached
(
XFS_IS_REALTIME_INODE
(
ip
)
?
mp
->
m_rtdev_targp
:
mp
->
m_ddev_targp
,
BTOBB
(
mp
->
m_sb
.
sb_blocksize
),
0
);
if
(
!
bp
)
return
-
ENOMEM
;
xfs_buf_unlock
(
bp
);
for
(
offset
=
startoff
;
offset
<=
endoff
;
offset
=
lastoffset
+
1
)
{
for
(
offset
=
startoff
;
offset
<=
endoff
;
offset
=
lastoffset
+
1
)
{
uint
lock_mode
;
uint
lock_mode
;
...
@@ -1152,42 +1144,24 @@ xfs_zero_remaining_bytes(
...
@@ -1152,42 +1144,24 @@ xfs_zero_remaining_bytes(
ASSERT
(
imap
.
br_startblock
!=
DELAYSTARTBLOCK
);
ASSERT
(
imap
.
br_startblock
!=
DELAYSTARTBLOCK
);
if
(
imap
.
br_state
==
XFS_EXT_UNWRITTEN
)
if
(
imap
.
br_state
==
XFS_EXT_UNWRITTEN
)
continue
;
continue
;
XFS_BUF_UNDONE
(
bp
);
XFS_BUF_UNWRITE
(
bp
);
XFS_BUF_READ
(
bp
);
XFS_BUF_SET_ADDR
(
bp
,
xfs_fsb_to_db
(
ip
,
imap
.
br_startblock
));
if
(
XFS_FORCED_SHUTDOWN
(
mp
))
{
error
=
xfs_buf_read_uncached
(
XFS_IS_REALTIME_INODE
(
ip
)
?
error
=
-
EIO
;
mp
->
m_rtdev_targp
:
mp
->
m_ddev_targp
,
break
;
xfs_fsb_to_db
(
ip
,
imap
.
br_startblock
),
}
BTOBB
(
mp
->
m_sb
.
sb_blocksize
),
xfs_buf_iorequest
(
bp
);
0
,
&
bp
,
NULL
);
error
=
xfs_buf_iowait
(
bp
);
if
(
error
)
if
(
error
)
{
return
error
;
xfs_buf_ioerror_alert
(
bp
,
"xfs_zero_remaining_bytes(read)"
);
break
;
}
memset
(
bp
->
b_addr
+
memset
(
bp
->
b_addr
+
(
offset
-
XFS_FSB_TO_B
(
mp
,
imap
.
br_startoff
)),
(
offset
-
XFS_FSB_TO_B
(
mp
,
imap
.
br_startoff
)),
0
,
lastoffset
-
offset
+
1
);
0
,
lastoffset
-
offset
+
1
);
XFS_BUF_UNDONE
(
bp
);
XFS_BUF_UNREAD
(
bp
);
error
=
xfs_bwrite
(
bp
);
XFS_BUF_WRITE
(
bp
);
xfs_buf_relse
(
bp
);
if
(
error
)
if
(
XFS_FORCED_SHUTDOWN
(
mp
))
{
return
error
;
error
=
-
EIO
;
break
;
}
xfs_buf_iorequest
(
bp
);
error
=
xfs_buf_iowait
(
bp
);
if
(
error
)
{
xfs_buf_ioerror_alert
(
bp
,
"xfs_zero_remaining_bytes(write)"
);
break
;
}
}
}
xfs_buf_free
(
bp
);
return
error
;
return
error
;
}
}
...
...
fs/xfs/xfs_buf.c
View file @
75e58ce4
This diff is collapsed.
Click to expand it.
fs/xfs/xfs_buf.h
View file @
75e58ce4
...
@@ -158,6 +158,7 @@ typedef struct xfs_buf {
...
@@ -158,6 +158,7 @@ typedef struct xfs_buf {
struct
list_head
b_lru
;
/* lru list */
struct
list_head
b_lru
;
/* lru list */
spinlock_t
b_lock
;
/* internal state lock */
spinlock_t
b_lock
;
/* internal state lock */
unsigned
int
b_state
;
/* internal state flags */
unsigned
int
b_state
;
/* internal state flags */
int
b_io_error
;
/* internal IO error state */
wait_queue_head_t
b_waiters
;
/* unpin waiters */
wait_queue_head_t
b_waiters
;
/* unpin waiters */
struct
list_head
b_list
;
struct
list_head
b_list
;
struct
xfs_perag
*
b_pag
;
/* contains rbtree root */
struct
xfs_perag
*
b_pag
;
/* contains rbtree root */
...
@@ -268,9 +269,9 @@ int xfs_buf_associate_memory(struct xfs_buf *bp, void *mem, size_t length);
...
@@ -268,9 +269,9 @@ int xfs_buf_associate_memory(struct xfs_buf *bp, void *mem, size_t length);
struct
xfs_buf
*
xfs_buf_get_uncached
(
struct
xfs_buftarg
*
target
,
size_t
numblks
,
struct
xfs_buf
*
xfs_buf_get_uncached
(
struct
xfs_buftarg
*
target
,
size_t
numblks
,
int
flags
);
int
flags
);
struct
xfs_buf
*
xfs_buf_read_uncached
(
struct
xfs_buftarg
*
target
,
int
xfs_buf_read_uncached
(
struct
xfs_buftarg
*
target
,
xfs_daddr_t
daddr
,
xfs_daddr_t
daddr
,
size_t
numblks
,
int
flags
,
size_t
numblks
,
int
flags
,
struct
xfs_buf
**
bpp
,
const
struct
xfs_buf_ops
*
ops
);
const
struct
xfs_buf_ops
*
ops
);
void
xfs_buf_hold
(
struct
xfs_buf
*
bp
);
void
xfs_buf_hold
(
struct
xfs_buf
*
bp
);
/* Releasing Buffers */
/* Releasing Buffers */
...
@@ -286,18 +287,16 @@ extern void xfs_buf_unlock(xfs_buf_t *);
...
@@ -286,18 +287,16 @@ extern void xfs_buf_unlock(xfs_buf_t *);
/* Buffer Read and Write Routines */
/* Buffer Read and Write Routines */
extern
int
xfs_bwrite
(
struct
xfs_buf
*
bp
);
extern
int
xfs_bwrite
(
struct
xfs_buf
*
bp
);
extern
void
xfs_buf_ioend
(
xfs_buf_t
*
,
int
);
extern
void
xfs_buf_ioend
(
struct
xfs_buf
*
bp
);
extern
void
xfs_buf_ioerror
(
xfs_buf_t
*
,
int
);
extern
void
xfs_buf_ioerror
(
xfs_buf_t
*
,
int
);
extern
void
xfs_buf_ioerror_alert
(
struct
xfs_buf
*
,
const
char
*
func
);
extern
void
xfs_buf_ioerror_alert
(
struct
xfs_buf
*
,
const
char
*
func
);
extern
void
xfs_buf_
iorequest
(
xfs_buf_t
*
);
extern
void
xfs_buf_
submit
(
struct
xfs_buf
*
bp
);
extern
int
xfs_buf_
iowait
(
xfs_buf_t
*
);
extern
int
xfs_buf_
submit_wait
(
struct
xfs_buf
*
bp
);
extern
void
xfs_buf_iomove
(
xfs_buf_t
*
,
size_t
,
size_t
,
void
*
,
extern
void
xfs_buf_iomove
(
xfs_buf_t
*
,
size_t
,
size_t
,
void
*
,
xfs_buf_rw_t
);
xfs_buf_rw_t
);
#define xfs_buf_zero(bp, off, len) \
#define xfs_buf_zero(bp, off, len) \
xfs_buf_iomove((bp), (off), (len), NULL, XBRW_ZERO)
xfs_buf_iomove((bp), (off), (len), NULL, XBRW_ZERO)
extern
int
xfs_bioerror_relse
(
struct
xfs_buf
*
);
/* Buffer Utility Routines */
/* Buffer Utility Routines */
extern
xfs_caddr_t
xfs_buf_offset
(
xfs_buf_t
*
,
size_t
);
extern
xfs_caddr_t
xfs_buf_offset
(
xfs_buf_t
*
,
size_t
);
...
...
fs/xfs/xfs_buf_item.c
View file @
75e58ce4
...
@@ -491,7 +491,7 @@ xfs_buf_item_unpin(
...
@@ -491,7 +491,7 @@ xfs_buf_item_unpin(
xfs_buf_ioerror
(
bp
,
-
EIO
);
xfs_buf_ioerror
(
bp
,
-
EIO
);
XFS_BUF_UNDONE
(
bp
);
XFS_BUF_UNDONE
(
bp
);
xfs_buf_stale
(
bp
);
xfs_buf_stale
(
bp
);
xfs_buf_ioend
(
bp
,
0
);
xfs_buf_ioend
(
bp
);
}
}
}
}
...
@@ -1081,7 +1081,7 @@ xfs_buf_iodone_callbacks(
...
@@ -1081,7 +1081,7 @@ xfs_buf_iodone_callbacks(
* a way to shut the filesystem down if the writes keep failing.
* a way to shut the filesystem down if the writes keep failing.
*
*
* In practice we'll shut the filesystem down soon as non-transient
* In practice we'll shut the filesystem down soon as non-transient
* er
or
rs tend to affect the whole device and a failing log write
* er
ro
rs tend to affect the whole device and a failing log write
* will make us give up. But we really ought to do better here.
* will make us give up. But we really ought to do better here.
*/
*/
if
(
XFS_BUF_ISASYNC
(
bp
))
{
if
(
XFS_BUF_ISASYNC
(
bp
))
{
...
@@ -1094,7 +1094,7 @@ xfs_buf_iodone_callbacks(
...
@@ -1094,7 +1094,7 @@ xfs_buf_iodone_callbacks(
if
(
!
(
bp
->
b_flags
&
(
XBF_STALE
|
XBF_WRITE_FAIL
)))
{
if
(
!
(
bp
->
b_flags
&
(
XBF_STALE
|
XBF_WRITE_FAIL
)))
{
bp
->
b_flags
|=
XBF_WRITE
|
XBF_ASYNC
|
bp
->
b_flags
|=
XBF_WRITE
|
XBF_ASYNC
|
XBF_DONE
|
XBF_WRITE_FAIL
;
XBF_DONE
|
XBF_WRITE_FAIL
;
xfs_buf_
ioreques
t
(
bp
);
xfs_buf_
submi
t
(
bp
);
}
else
{
}
else
{
xfs_buf_relse
(
bp
);
xfs_buf_relse
(
bp
);
}
}
...
@@ -1115,7 +1115,7 @@ xfs_buf_iodone_callbacks(
...
@@ -1115,7 +1115,7 @@ xfs_buf_iodone_callbacks(
xfs_buf_do_callbacks
(
bp
);
xfs_buf_do_callbacks
(
bp
);
bp
->
b_fspriv
=
NULL
;
bp
->
b_fspriv
=
NULL
;
bp
->
b_iodone
=
NULL
;
bp
->
b_iodone
=
NULL
;
xfs_buf_ioend
(
bp
,
0
);
xfs_buf_ioend
(
bp
);
}
}
/*
/*
...
...
fs/xfs/xfs_fsops.c
View file @
75e58ce4
...
@@ -172,16 +172,11 @@ xfs_growfs_data_private(
...
@@ -172,16 +172,11 @@ xfs_growfs_data_private(
if
((
error
=
xfs_sb_validate_fsb_count
(
&
mp
->
m_sb
,
nb
)))
if
((
error
=
xfs_sb_validate_fsb_count
(
&
mp
->
m_sb
,
nb
)))
return
error
;
return
error
;
dpct
=
pct
-
mp
->
m_sb
.
sb_imax_pct
;
dpct
=
pct
-
mp
->
m_sb
.
sb_imax_pct
;
bp
=
xfs_buf_read_uncached
(
mp
->
m_ddev_targp
,
error
=
xfs_buf_read_uncached
(
mp
->
m_ddev_targp
,
XFS_FSB_TO_BB
(
mp
,
nb
)
-
XFS_FSS_TO_BB
(
mp
,
1
),
XFS_FSB_TO_BB
(
mp
,
nb
)
-
XFS_FSS_TO_BB
(
mp
,
1
),
XFS_FSS_TO_BB
(
mp
,
1
),
0
,
NULL
);
XFS_FSS_TO_BB
(
mp
,
1
),
0
,
&
bp
,
NULL
);
if
(
!
bp
)
if
(
error
)
return
-
EIO
;
if
(
bp
->
b_error
)
{
error
=
bp
->
b_error
;
xfs_buf_relse
(
bp
);
return
error
;
return
error
;
}
xfs_buf_relse
(
bp
);
xfs_buf_relse
(
bp
);
new
=
nb
;
/* use new as a temporary here */
new
=
nb
;
/* use new as a temporary here */
...
...
fs/xfs/xfs_inode.c
View file @
75e58ce4
...
@@ -3062,7 +3062,7 @@ xfs_iflush_cluster(
...
@@ -3062,7 +3062,7 @@ xfs_iflush_cluster(
XFS_BUF_UNDONE
(
bp
);
XFS_BUF_UNDONE
(
bp
);
xfs_buf_stale
(
bp
);
xfs_buf_stale
(
bp
);
xfs_buf_ioerror
(
bp
,
-
EIO
);
xfs_buf_ioerror
(
bp
,
-
EIO
);
xfs_buf_ioend
(
bp
,
0
);
xfs_buf_ioend
(
bp
);
}
else
{
}
else
{
xfs_buf_stale
(
bp
);
xfs_buf_stale
(
bp
);
xfs_buf_relse
(
bp
);
xfs_buf_relse
(
bp
);
...
...
fs/xfs/xfs_log.c
View file @
75e58ce4
...
@@ -1678,7 +1678,7 @@ xlog_bdstrat(
...
@@ -1678,7 +1678,7 @@ xlog_bdstrat(
if
(
iclog
->
ic_state
&
XLOG_STATE_IOERROR
)
{
if
(
iclog
->
ic_state
&
XLOG_STATE_IOERROR
)
{
xfs_buf_ioerror
(
bp
,
-
EIO
);
xfs_buf_ioerror
(
bp
,
-
EIO
);
xfs_buf_stale
(
bp
);
xfs_buf_stale
(
bp
);
xfs_buf_ioend
(
bp
,
0
);
xfs_buf_ioend
(
bp
);
/*
/*
* It would seem logical to return EIO here, but we rely on
* It would seem logical to return EIO here, but we rely on
* the log state machine to propagate I/O errors instead of
* the log state machine to propagate I/O errors instead of
...
@@ -1688,7 +1688,7 @@ xlog_bdstrat(
...
@@ -1688,7 +1688,7 @@ xlog_bdstrat(
return
0
;
return
0
;
}
}
xfs_buf_
ioreques
t
(
bp
);
xfs_buf_
submi
t
(
bp
);
return
0
;
return
0
;
}
}
...
@@ -3867,18 +3867,17 @@ xlog_state_ioerror(
...
@@ -3867,18 +3867,17 @@ xlog_state_ioerror(
* This is called from xfs_force_shutdown, when we're forcibly
* This is called from xfs_force_shutdown, when we're forcibly
* shutting down the filesystem, typically because of an IO error.
* shutting down the filesystem, typically because of an IO error.
* Our main objectives here are to make sure that:
* Our main objectives here are to make sure that:
* a. the filesystem gets marked 'SHUTDOWN' for all interested
* a. if !logerror, flush the logs to disk. Anything modified
* after this is ignored.
* b. the filesystem gets marked 'SHUTDOWN' for all interested
* parties to find out, 'atomically'.
* parties to find out, 'atomically'.
*
b
. those who're sleeping on log reservations, pinned objects and
*
c
. those who're sleeping on log reservations, pinned objects and
* other resources get woken up, and be told the bad news.
* other resources get woken up, and be told the bad news.
* c. nothing new gets queued up after (a) and (b) are done.
* d. nothing new gets queued up after (b) and (c) are done.
* d. if !logerror, flush the iclogs to disk, then seal them off
* for business.
*
*
* Note: for delayed logging the !logerror case needs to flush the regions
* Note: for the !logerror case we need to flush the regions held in memory out
* held in memory out to the iclogs before flushing them to disk. This needs
* to disk first. This needs to be done before the log is marked as shutdown,
* to be done before the log is marked as shutdown, otherwise the flush to the
* otherwise the iclog writes will fail.
* iclogs will fail.
*/
*/
int
int
xfs_log_force_umount
(
xfs_log_force_umount
(
...
@@ -3910,16 +3909,16 @@ xfs_log_force_umount(
...
@@ -3910,16 +3909,16 @@ xfs_log_force_umount(
ASSERT
(
XLOG_FORCED_SHUTDOWN
(
log
));
ASSERT
(
XLOG_FORCED_SHUTDOWN
(
log
));
return
1
;
return
1
;
}
}
retval
=
0
;
/*
/*
* Flush the in memory commit item list before marking the log as
* Flush all the completed transactions to disk before marking the log
* being shut down. We need to do it in this order to ensure all the
* being shut down. We need to do it in this order to ensure that
* completed transactions are flushed to disk with the xfs_log_force()
* completed operations are safely on disk before we shut down, and that
* call below.
* we don't have to issue any buffer IO after the shutdown flags are set
* to guarantee this.
*/
*/
if
(
!
logerror
)
if
(
!
logerror
)
xlog_cil_force
(
log
);
_xfs_log_force
(
mp
,
XFS_LOG_SYNC
,
NULL
);
/*
/*
* mark the filesystem and the as in a shutdown state and wake
* mark the filesystem and the as in a shutdown state and wake
...
@@ -3931,18 +3930,11 @@ xfs_log_force_umount(
...
@@ -3931,18 +3930,11 @@ xfs_log_force_umount(
XFS_BUF_DONE
(
mp
->
m_sb_bp
);
XFS_BUF_DONE
(
mp
->
m_sb_bp
);
/*
/*
* This flag is sort of redundant because of the mount flag, but
* Mark the log and the iclogs with IO error flags to prevent any
* it's good to maintain the separation between the log and the rest
* further log IO from being issued or completed.
* of XFS.
*/
*/
log
->
l_flags
|=
XLOG_IO_ERROR
;
log
->
l_flags
|=
XLOG_IO_ERROR
;
retval
=
xlog_state_ioerror
(
log
);
/*
* If we hit a log error, we want to mark all the iclogs IOERROR
* while we're still holding the loglock.
*/
if
(
logerror
)
retval
=
xlog_state_ioerror
(
log
);
spin_unlock
(
&
log
->
l_icloglock
);
spin_unlock
(
&
log
->
l_icloglock
);
/*
/*
...
@@ -3955,19 +3947,6 @@ xfs_log_force_umount(
...
@@ -3955,19 +3947,6 @@ xfs_log_force_umount(
xlog_grant_head_wake_all
(
&
log
->
l_reserve_head
);
xlog_grant_head_wake_all
(
&
log
->
l_reserve_head
);
xlog_grant_head_wake_all
(
&
log
->
l_write_head
);
xlog_grant_head_wake_all
(
&
log
->
l_write_head
);
if
(
!
(
log
->
l_iclog
->
ic_state
&
XLOG_STATE_IOERROR
))
{
ASSERT
(
!
logerror
);
/*
* Force the incore logs to disk before shutting the
* log down completely.
*/
_xfs_log_force
(
mp
,
XFS_LOG_SYNC
,
NULL
);
spin_lock
(
&
log
->
l_icloglock
);
retval
=
xlog_state_ioerror
(
log
);
spin_unlock
(
&
log
->
l_icloglock
);
}
/*
/*
* Wake up everybody waiting on xfs_log_force. Wake the CIL push first
* Wake up everybody waiting on xfs_log_force. Wake the CIL push first
* as if the log writes were completed. The abort handling in the log
* as if the log writes were completed. The abort handling in the log
...
...
fs/xfs/xfs_log_recover.c
View file @
75e58ce4
...
@@ -193,12 +193,8 @@ xlog_bread_noalign(
...
@@ -193,12 +193,8 @@ xlog_bread_noalign(
bp
->
b_io_length
=
nbblks
;
bp
->
b_io_length
=
nbblks
;
bp
->
b_error
=
0
;
bp
->
b_error
=
0
;
if
(
XFS_FORCED_SHUTDOWN
(
log
->
l_mp
))
error
=
xfs_buf_submit_wait
(
bp
);
return
-
EIO
;
if
(
error
&&
!
XFS_FORCED_SHUTDOWN
(
log
->
l_mp
))
xfs_buf_iorequest
(
bp
);
error
=
xfs_buf_iowait
(
bp
);
if
(
error
)
xfs_buf_ioerror_alert
(
bp
,
__func__
);
xfs_buf_ioerror_alert
(
bp
,
__func__
);
return
error
;
return
error
;
}
}
...
@@ -378,12 +374,14 @@ xlog_recover_iodone(
...
@@ -378,12 +374,14 @@ xlog_recover_iodone(
* We're not going to bother about retrying
* We're not going to bother about retrying
* this during recovery. One strike!
* this during recovery. One strike!
*/
*/
xfs_buf_ioerror_alert
(
bp
,
__func__
);
if
(
!
XFS_FORCED_SHUTDOWN
(
bp
->
b_target
->
bt_mount
))
{
xfs_force_shutdown
(
bp
->
b_target
->
bt_mount
,
xfs_buf_ioerror_alert
(
bp
,
__func__
);
SHUTDOWN_META_IO_ERROR
);
xfs_force_shutdown
(
bp
->
b_target
->
bt_mount
,
SHUTDOWN_META_IO_ERROR
);
}
}
}
bp
->
b_iodone
=
NULL
;
bp
->
b_iodone
=
NULL
;
xfs_buf_ioend
(
bp
,
0
);
xfs_buf_ioend
(
bp
);
}
}
/*
/*
...
@@ -4452,16 +4450,12 @@ xlog_do_recover(
...
@@ -4452,16 +4450,12 @@ xlog_do_recover(
XFS_BUF_UNASYNC
(
bp
);
XFS_BUF_UNASYNC
(
bp
);
bp
->
b_ops
=
&
xfs_sb_buf_ops
;
bp
->
b_ops
=
&
xfs_sb_buf_ops
;
if
(
XFS_FORCED_SHUTDOWN
(
log
->
l_mp
))
{
error
=
xfs_buf_submit_wait
(
bp
);
xfs_buf_relse
(
bp
);
return
-
EIO
;
}
xfs_buf_iorequest
(
bp
);
error
=
xfs_buf_iowait
(
bp
);
if
(
error
)
{
if
(
error
)
{
xfs_buf_ioerror_alert
(
bp
,
__func__
);
if
(
!
XFS_FORCED_SHUTDOWN
(
log
->
l_mp
))
{
ASSERT
(
0
);
xfs_buf_ioerror_alert
(
bp
,
__func__
);
ASSERT
(
0
);
}
xfs_buf_relse
(
bp
);
xfs_buf_relse
(
bp
);
return
error
;
return
error
;
}
}
...
...
fs/xfs/xfs_mount.c
View file @
75e58ce4
...
@@ -300,21 +300,15 @@ xfs_readsb(
...
@@ -300,21 +300,15 @@ xfs_readsb(
* access to the superblock.
* access to the superblock.
*/
*/
reread:
reread:
bp
=
xfs_buf_read_uncached
(
mp
->
m_ddev_targp
,
XFS_SB_DADDR
,
error
=
xfs_buf_read_uncached
(
mp
->
m_ddev_targp
,
XFS_SB_DADDR
,
BTOBB
(
sector_size
),
0
,
buf_ops
);
BTOBB
(
sector_size
),
0
,
&
bp
,
buf_ops
);
if
(
!
bp
)
{
if
(
error
)
{
if
(
loud
)
xfs_warn
(
mp
,
"SB buffer read failed"
);
return
-
EIO
;
}
if
(
bp
->
b_error
)
{
error
=
bp
->
b_error
;
if
(
loud
)
if
(
loud
)
xfs_warn
(
mp
,
"SB validate failed with error %d."
,
error
);
xfs_warn
(
mp
,
"SB validate failed with error %d."
,
error
);
/* bad CRC means corrupted metadata */
/* bad CRC means corrupted metadata */
if
(
error
==
-
EFSBADCRC
)
if
(
error
==
-
EFSBADCRC
)
error
=
-
EFSCORRUPTED
;
error
=
-
EFSCORRUPTED
;
goto
release_buf
;
return
error
;
}
}
/*
/*
...
@@ -544,40 +538,43 @@ xfs_set_inoalignment(xfs_mount_t *mp)
...
@@ -544,40 +538,43 @@ xfs_set_inoalignment(xfs_mount_t *mp)
* Check that the data (and log if separate) is an ok size.
* Check that the data (and log if separate) is an ok size.
*/
*/
STATIC
int
STATIC
int
xfs_check_sizes
(
xfs_mount_t
*
mp
)
xfs_check_sizes
(
struct
xfs_mount
*
mp
)
{
{
xfs_buf_t
*
bp
;
struct
xfs_buf
*
bp
;
xfs_daddr_t
d
;
xfs_daddr_t
d
;
int
error
;
d
=
(
xfs_daddr_t
)
XFS_FSB_TO_BB
(
mp
,
mp
->
m_sb
.
sb_dblocks
);
d
=
(
xfs_daddr_t
)
XFS_FSB_TO_BB
(
mp
,
mp
->
m_sb
.
sb_dblocks
);
if
(
XFS_BB_TO_FSB
(
mp
,
d
)
!=
mp
->
m_sb
.
sb_dblocks
)
{
if
(
XFS_BB_TO_FSB
(
mp
,
d
)
!=
mp
->
m_sb
.
sb_dblocks
)
{
xfs_warn
(
mp
,
"filesystem size mismatch detected"
);
xfs_warn
(
mp
,
"filesystem size mismatch detected"
);
return
-
EFBIG
;
return
-
EFBIG
;
}
}
bp
=
xfs_buf_read_uncached
(
mp
->
m_ddev_targp
,
error
=
xfs_buf_read_uncached
(
mp
->
m_ddev_targp
,
d
-
XFS_FSS_TO_BB
(
mp
,
1
),
d
-
XFS_FSS_TO_BB
(
mp
,
1
),
XFS_FSS_TO_BB
(
mp
,
1
),
0
,
NULL
);
XFS_FSS_TO_BB
(
mp
,
1
),
0
,
&
bp
,
NULL
);
if
(
!
bp
)
{
if
(
error
)
{
xfs_warn
(
mp
,
"last sector read failed"
);
xfs_warn
(
mp
,
"last sector read failed"
);
return
-
EIO
;
return
error
;
}
}
xfs_buf_relse
(
bp
);
xfs_buf_relse
(
bp
);
if
(
mp
->
m_logdev_targp
!=
mp
->
m_ddev_targp
)
{
if
(
mp
->
m_logdev_targp
==
mp
->
m_ddev_targp
)
d
=
(
xfs_daddr_t
)
XFS_FSB_TO_BB
(
mp
,
mp
->
m_sb
.
sb_logblocks
);
return
0
;
if
(
XFS_BB_TO_FSB
(
mp
,
d
)
!=
mp
->
m_sb
.
sb_logblocks
)
{
xfs_warn
(
mp
,
"log size mismatch detected"
);
d
=
(
xfs_daddr_t
)
XFS_FSB_TO_BB
(
mp
,
mp
->
m_sb
.
sb_logblocks
);
return
-
EFBIG
;
if
(
XFS_BB_TO_FSB
(
mp
,
d
)
!=
mp
->
m_sb
.
sb_logblocks
)
{
}
xfs_warn
(
mp
,
"log size mismatch detected"
);
bp
=
xfs_buf_read_uncached
(
mp
->
m_logdev_targp
,
return
-
EFBIG
;
}
error
=
xfs_buf_read_uncached
(
mp
->
m_logdev_targp
,
d
-
XFS_FSB_TO_BB
(
mp
,
1
),
d
-
XFS_FSB_TO_BB
(
mp
,
1
),
XFS_FSB_TO_BB
(
mp
,
1
),
0
,
NULL
);
XFS_FSB_TO_BB
(
mp
,
1
),
0
,
&
bp
,
NULL
);
if
(
!
bp
)
{
if
(
error
)
{
xfs_warn
(
mp
,
"log device read failed"
);
xfs_warn
(
mp
,
"log device read failed"
);
return
-
EIO
;
return
error
;
}
xfs_buf_relse
(
bp
);
}
}
xfs_buf_relse
(
bp
);
return
0
;
return
0
;
}
}
...
...
fs/xfs/xfs_rtalloc.c
View file @
75e58ce4
...
@@ -921,16 +921,11 @@ xfs_growfs_rt(
...
@@ -921,16 +921,11 @@ xfs_growfs_rt(
/*
/*
* Read in the last block of the device, make sure it exists.
* Read in the last block of the device, make sure it exists.
*/
*/
bp
=
xfs_buf_read_uncached
(
mp
->
m_rtdev_targp
,
error
=
xfs_buf_read_uncached
(
mp
->
m_rtdev_targp
,
XFS_FSB_TO_BB
(
mp
,
nrblocks
-
1
),
XFS_FSB_TO_BB
(
mp
,
nrblocks
-
1
),
XFS_FSB_TO_BB
(
mp
,
1
),
0
,
NULL
);
XFS_FSB_TO_BB
(
mp
,
1
),
0
,
&
bp
,
NULL
);
if
(
!
bp
)
if
(
error
)
return
-
EIO
;
if
(
bp
->
b_error
)
{
error
=
bp
->
b_error
;
xfs_buf_relse
(
bp
);
return
error
;
return
error
;
}
xfs_buf_relse
(
bp
);
xfs_buf_relse
(
bp
);
/*
/*
...
@@ -1184,11 +1179,12 @@ xfs_rtallocate_extent(
...
@@ -1184,11 +1179,12 @@ xfs_rtallocate_extent(
*/
*/
int
/* error */
int
/* error */
xfs_rtmount_init
(
xfs_rtmount_init
(
xfs_mount_
t
*
mp
)
/* file system mount structure */
struct
xfs_moun
t
*
mp
)
/* file system mount structure */
{
{
xfs_buf_t
*
bp
;
/* buffer for last block of subvolume */
struct
xfs_buf
*
bp
;
/* buffer for last block of subvolume */
xfs_daddr_t
d
;
/* address of last block of subvolume */
struct
xfs_sb
*
sbp
;
/* filesystem superblock copy in mount */
xfs_sb_t
*
sbp
;
/* filesystem superblock copy in mount */
xfs_daddr_t
d
;
/* address of last block of subvolume */
int
error
;
sbp
=
&
mp
->
m_sb
;
sbp
=
&
mp
->
m_sb
;
if
(
sbp
->
sb_rblocks
==
0
)
if
(
sbp
->
sb_rblocks
==
0
)
...
@@ -1214,14 +1210,12 @@ xfs_rtmount_init(
...
@@ -1214,14 +1210,12 @@ xfs_rtmount_init(
(
unsigned
long
long
)
mp
->
m_sb
.
sb_rblocks
);
(
unsigned
long
long
)
mp
->
m_sb
.
sb_rblocks
);
return
-
EFBIG
;
return
-
EFBIG
;
}
}
bp
=
xfs_buf_read_uncached
(
mp
->
m_rtdev_targp
,
error
=
xfs_buf_read_uncached
(
mp
->
m_rtdev_targp
,
d
-
XFS_FSB_TO_BB
(
mp
,
1
),
d
-
XFS_FSB_TO_BB
(
mp
,
1
),
XFS_FSB_TO_BB
(
mp
,
1
),
0
,
NULL
);
XFS_FSB_TO_BB
(
mp
,
1
),
0
,
&
bp
,
NULL
);
if
(
!
bp
||
bp
->
b_
error
)
{
if
(
error
)
{
xfs_warn
(
mp
,
"realtime device size check failed"
);
xfs_warn
(
mp
,
"realtime device size check failed"
);
if
(
bp
)
return
error
;
xfs_buf_relse
(
bp
);
return
-
EIO
;
}
}
xfs_buf_relse
(
bp
);
xfs_buf_relse
(
bp
);
return
0
;
return
0
;
...
...
fs/xfs/xfs_trace.h
View file @
75e58ce4
...
@@ -349,7 +349,8 @@ DEFINE_BUF_EVENT(xfs_buf_free);
...
@@ -349,7 +349,8 @@ DEFINE_BUF_EVENT(xfs_buf_free);
DEFINE_BUF_EVENT
(
xfs_buf_hold
);
DEFINE_BUF_EVENT
(
xfs_buf_hold
);
DEFINE_BUF_EVENT
(
xfs_buf_rele
);
DEFINE_BUF_EVENT
(
xfs_buf_rele
);
DEFINE_BUF_EVENT
(
xfs_buf_iodone
);
DEFINE_BUF_EVENT
(
xfs_buf_iodone
);
DEFINE_BUF_EVENT
(
xfs_buf_iorequest
);
DEFINE_BUF_EVENT
(
xfs_buf_submit
);
DEFINE_BUF_EVENT
(
xfs_buf_submit_wait
);
DEFINE_BUF_EVENT
(
xfs_buf_bawrite
);
DEFINE_BUF_EVENT
(
xfs_buf_bawrite
);
DEFINE_BUF_EVENT
(
xfs_buf_lock
);
DEFINE_BUF_EVENT
(
xfs_buf_lock
);
DEFINE_BUF_EVENT
(
xfs_buf_lock_done
);
DEFINE_BUF_EVENT
(
xfs_buf_lock_done
);
...
...
fs/xfs/xfs_trans_buf.c
View file @
75e58ce4
...
@@ -318,20 +318,10 @@ xfs_trans_read_buf_map(
...
@@ -318,20 +318,10 @@ xfs_trans_read_buf_map(
XFS_BUF_READ
(
bp
);
XFS_BUF_READ
(
bp
);
bp
->
b_ops
=
ops
;
bp
->
b_ops
=
ops
;
/*
error
=
xfs_buf_submit_wait
(
bp
);
* XXX(hch): clean up the error handling here to be less
* of a mess..
*/
if
(
XFS_FORCED_SHUTDOWN
(
mp
))
{
trace_xfs_bdstrat_shut
(
bp
,
_RET_IP_
);
xfs_bioerror_relse
(
bp
);
}
else
{
xfs_buf_iorequest
(
bp
);
}
error
=
xfs_buf_iowait
(
bp
);
if
(
error
)
{
if
(
error
)
{
xfs_buf_ioerror_alert
(
bp
,
__func__
);
if
(
!
XFS_FORCED_SHUTDOWN
(
mp
))
xfs_buf_ioerror_alert
(
bp
,
__func__
);
xfs_buf_relse
(
bp
);
xfs_buf_relse
(
bp
);
/*
/*
* We can gracefully recover from most read
* We can gracefully recover from most read
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment