diff options
Diffstat (limited to 'fs/xfs/libxfs')
| -rw-r--r-- | fs/xfs/libxfs/xfs_alloc.c | 8 | ||||
| -rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 15 | ||||
| -rw-r--r-- | fs/xfs/libxfs/xfs_bmap.h | 1 | ||||
| -rw-r--r-- | fs/xfs/libxfs/xfs_ialloc.c | 4 | ||||
| -rw-r--r-- | fs/xfs/libxfs/xfs_log_format.h | 27 |
5 files changed, 32 insertions, 23 deletions
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c index 744dcaec34cc..f965ce832bc0 100644 --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c | |||
| @@ -1584,6 +1584,10 @@ xfs_alloc_ag_vextent_small( | |||
| 1584 | 1584 | ||
| 1585 | bp = xfs_btree_get_bufs(args->mp, args->tp, | 1585 | bp = xfs_btree_get_bufs(args->mp, args->tp, |
| 1586 | args->agno, fbno, 0); | 1586 | args->agno, fbno, 0); |
| 1587 | if (!bp) { | ||
| 1588 | error = -EFSCORRUPTED; | ||
| 1589 | goto error0; | ||
| 1590 | } | ||
| 1587 | xfs_trans_binval(args->tp, bp); | 1591 | xfs_trans_binval(args->tp, bp); |
| 1588 | } | 1592 | } |
| 1589 | args->len = 1; | 1593 | args->len = 1; |
| @@ -2141,6 +2145,10 @@ xfs_alloc_fix_freelist( | |||
| 2141 | if (error) | 2145 | if (error) |
| 2142 | goto out_agbp_relse; | 2146 | goto out_agbp_relse; |
| 2143 | bp = xfs_btree_get_bufs(mp, tp, args->agno, bno, 0); | 2147 | bp = xfs_btree_get_bufs(mp, tp, args->agno, bno, 0); |
| 2148 | if (!bp) { | ||
| 2149 | error = -EFSCORRUPTED; | ||
| 2150 | goto out_agbp_relse; | ||
| 2151 | } | ||
| 2144 | xfs_trans_binval(tp, bp); | 2152 | xfs_trans_binval(tp, bp); |
| 2145 | } | 2153 | } |
| 2146 | 2154 | ||
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 044a363119be..89263797cf32 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c | |||
| @@ -1477,14 +1477,14 @@ xfs_bmap_isaeof( | |||
| 1477 | int is_empty; | 1477 | int is_empty; |
| 1478 | int error; | 1478 | int error; |
| 1479 | 1479 | ||
| 1480 | bma->aeof = 0; | 1480 | bma->aeof = false; |
| 1481 | error = xfs_bmap_last_extent(NULL, bma->ip, whichfork, &rec, | 1481 | error = xfs_bmap_last_extent(NULL, bma->ip, whichfork, &rec, |
| 1482 | &is_empty); | 1482 | &is_empty); |
| 1483 | if (error) | 1483 | if (error) |
| 1484 | return error; | 1484 | return error; |
| 1485 | 1485 | ||
| 1486 | if (is_empty) { | 1486 | if (is_empty) { |
| 1487 | bma->aeof = 1; | 1487 | bma->aeof = true; |
| 1488 | return 0; | 1488 | return 0; |
| 1489 | } | 1489 | } |
| 1490 | 1490 | ||
| @@ -3852,6 +3852,17 @@ xfs_trim_extent( | |||
| 3852 | } | 3852 | } |
| 3853 | } | 3853 | } |
| 3854 | 3854 | ||
| 3855 | /* trim extent to within eof */ | ||
| 3856 | void | ||
| 3857 | xfs_trim_extent_eof( | ||
| 3858 | struct xfs_bmbt_irec *irec, | ||
| 3859 | struct xfs_inode *ip) | ||
| 3860 | |||
| 3861 | { | ||
| 3862 | xfs_trim_extent(irec, 0, XFS_B_TO_FSB(ip->i_mount, | ||
| 3863 | i_size_read(VFS_I(ip)))); | ||
| 3864 | } | ||
| 3865 | |||
| 3855 | /* | 3866 | /* |
| 3856 | * Trim the returned map to the required bounds | 3867 | * Trim the returned map to the required bounds |
| 3857 | */ | 3868 | */ |
diff --git a/fs/xfs/libxfs/xfs_bmap.h b/fs/xfs/libxfs/xfs_bmap.h index 851982a5dfbc..502e0d8fb4ff 100644 --- a/fs/xfs/libxfs/xfs_bmap.h +++ b/fs/xfs/libxfs/xfs_bmap.h | |||
| @@ -208,6 +208,7 @@ void xfs_bmap_trace_exlist(struct xfs_inode *ip, xfs_extnum_t cnt, | |||
| 208 | 208 | ||
| 209 | void xfs_trim_extent(struct xfs_bmbt_irec *irec, xfs_fileoff_t bno, | 209 | void xfs_trim_extent(struct xfs_bmbt_irec *irec, xfs_fileoff_t bno, |
| 210 | xfs_filblks_t len); | 210 | xfs_filblks_t len); |
| 211 | void xfs_trim_extent_eof(struct xfs_bmbt_irec *, struct xfs_inode *); | ||
| 211 | int xfs_bmap_add_attrfork(struct xfs_inode *ip, int size, int rsvd); | 212 | int xfs_bmap_add_attrfork(struct xfs_inode *ip, int size, int rsvd); |
| 212 | void xfs_bmap_local_to_extents_empty(struct xfs_inode *ip, int whichfork); | 213 | void xfs_bmap_local_to_extents_empty(struct xfs_inode *ip, int whichfork); |
| 213 | void xfs_bmap_add_free(struct xfs_mount *mp, struct xfs_defer_ops *dfops, | 214 | void xfs_bmap_add_free(struct xfs_mount *mp, struct xfs_defer_ops *dfops, |
diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c index 988bb3f31446..dfd643909f85 100644 --- a/fs/xfs/libxfs/xfs_ialloc.c +++ b/fs/xfs/libxfs/xfs_ialloc.c | |||
| @@ -1962,7 +1962,7 @@ xfs_difree_inobt( | |||
| 1962 | if (!(mp->m_flags & XFS_MOUNT_IKEEP) && | 1962 | if (!(mp->m_flags & XFS_MOUNT_IKEEP) && |
| 1963 | rec.ir_free == XFS_INOBT_ALL_FREE && | 1963 | rec.ir_free == XFS_INOBT_ALL_FREE && |
| 1964 | mp->m_sb.sb_inopblock <= XFS_INODES_PER_CHUNK) { | 1964 | mp->m_sb.sb_inopblock <= XFS_INODES_PER_CHUNK) { |
| 1965 | xic->deleted = 1; | 1965 | xic->deleted = true; |
| 1966 | xic->first_ino = XFS_AGINO_TO_INO(mp, agno, rec.ir_startino); | 1966 | xic->first_ino = XFS_AGINO_TO_INO(mp, agno, rec.ir_startino); |
| 1967 | xic->alloc = xfs_inobt_irec_to_allocmask(&rec); | 1967 | xic->alloc = xfs_inobt_irec_to_allocmask(&rec); |
| 1968 | 1968 | ||
| @@ -1989,7 +1989,7 @@ xfs_difree_inobt( | |||
| 1989 | 1989 | ||
| 1990 | xfs_difree_inode_chunk(mp, agno, &rec, dfops); | 1990 | xfs_difree_inode_chunk(mp, agno, &rec, dfops); |
| 1991 | } else { | 1991 | } else { |
| 1992 | xic->deleted = 0; | 1992 | xic->deleted = false; |
| 1993 | 1993 | ||
| 1994 | error = xfs_inobt_update(cur, &rec); | 1994 | error = xfs_inobt_update(cur, &rec); |
| 1995 | if (error) { | 1995 | if (error) { |
diff --git a/fs/xfs/libxfs/xfs_log_format.h b/fs/xfs/libxfs/xfs_log_format.h index 8372e9bcd7b6..71de185735e0 100644 --- a/fs/xfs/libxfs/xfs_log_format.h +++ b/fs/xfs/libxfs/xfs_log_format.h | |||
| @@ -270,6 +270,7 @@ typedef struct xfs_inode_log_format { | |||
| 270 | uint32_t ilf_fields; /* flags for fields logged */ | 270 | uint32_t ilf_fields; /* flags for fields logged */ |
| 271 | uint16_t ilf_asize; /* size of attr d/ext/root */ | 271 | uint16_t ilf_asize; /* size of attr d/ext/root */ |
| 272 | uint16_t ilf_dsize; /* size of data/ext/root */ | 272 | uint16_t ilf_dsize; /* size of data/ext/root */ |
| 273 | uint32_t ilf_pad; /* pad for 64 bit boundary */ | ||
| 273 | uint64_t ilf_ino; /* inode number */ | 274 | uint64_t ilf_ino; /* inode number */ |
| 274 | union { | 275 | union { |
| 275 | uint32_t ilfu_rdev; /* rdev value for dev inode*/ | 276 | uint32_t ilfu_rdev; /* rdev value for dev inode*/ |
| @@ -280,29 +281,17 @@ typedef struct xfs_inode_log_format { | |||
| 280 | int32_t ilf_boffset; /* off of inode in buffer */ | 281 | int32_t ilf_boffset; /* off of inode in buffer */ |
| 281 | } xfs_inode_log_format_t; | 282 | } xfs_inode_log_format_t; |
| 282 | 283 | ||
| 283 | typedef struct xfs_inode_log_format_32 { | 284 | /* |
| 284 | uint16_t ilf_type; /* inode log item type */ | 285 | * Old 32 bit systems will log in this format without the 64 bit |
| 285 | uint16_t ilf_size; /* size of this item */ | 286 | * alignment padding. Recovery will detect this and convert it to the |
| 286 | uint32_t ilf_fields; /* flags for fields logged */ | 287 | * correct format. |
| 287 | uint16_t ilf_asize; /* size of attr d/ext/root */ | 288 | */ |
| 288 | uint16_t ilf_dsize; /* size of data/ext/root */ | 289 | struct xfs_inode_log_format_32 { |
| 289 | uint64_t ilf_ino; /* inode number */ | ||
| 290 | union { | ||
| 291 | uint32_t ilfu_rdev; /* rdev value for dev inode*/ | ||
| 292 | uuid_t ilfu_uuid; /* mount point value */ | ||
| 293 | } ilf_u; | ||
| 294 | int64_t ilf_blkno; /* blkno of inode buffer */ | ||
| 295 | int32_t ilf_len; /* len of inode buffer */ | ||
| 296 | int32_t ilf_boffset; /* off of inode in buffer */ | ||
| 297 | } __attribute__((packed)) xfs_inode_log_format_32_t; | ||
| 298 | |||
| 299 | typedef struct xfs_inode_log_format_64 { | ||
| 300 | uint16_t ilf_type; /* inode log item type */ | 290 | uint16_t ilf_type; /* inode log item type */ |
| 301 | uint16_t ilf_size; /* size of this item */ | 291 | uint16_t ilf_size; /* size of this item */ |
| 302 | uint32_t ilf_fields; /* flags for fields logged */ | 292 | uint32_t ilf_fields; /* flags for fields logged */ |
| 303 | uint16_t ilf_asize; /* size of attr d/ext/root */ | 293 | uint16_t ilf_asize; /* size of attr d/ext/root */ |
| 304 | uint16_t ilf_dsize; /* size of data/ext/root */ | 294 | uint16_t ilf_dsize; /* size of data/ext/root */ |
| 305 | uint32_t ilf_pad; /* pad for 64 bit boundary */ | ||
| 306 | uint64_t ilf_ino; /* inode number */ | 295 | uint64_t ilf_ino; /* inode number */ |
| 307 | union { | 296 | union { |
| 308 | uint32_t ilfu_rdev; /* rdev value for dev inode*/ | 297 | uint32_t ilfu_rdev; /* rdev value for dev inode*/ |
| @@ -311,7 +300,7 @@ typedef struct xfs_inode_log_format_64 { | |||
| 311 | int64_t ilf_blkno; /* blkno of inode buffer */ | 300 | int64_t ilf_blkno; /* blkno of inode buffer */ |
| 312 | int32_t ilf_len; /* len of inode buffer */ | 301 | int32_t ilf_len; /* len of inode buffer */ |
| 313 | int32_t ilf_boffset; /* off of inode in buffer */ | 302 | int32_t ilf_boffset; /* off of inode in buffer */ |
| 314 | } xfs_inode_log_format_64_t; | 303 | } __attribute__((packed)); |
| 315 | 304 | ||
| 316 | 305 | ||
| 317 | /* | 306 | /* |
