mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
More new code for 5.13:
- Rename the log timestamp struct. - Remove broken transaction counter debugging that wasn't working correctly on very old filesystems. - Various fixes to make pre-lazysbcount filesystems work properly again. - Fix a free space accounting problem where we neglected to consider free space btree blocks that track metadata reservation space when deciding whether or not to allow caller to reserve space for a metadata update. - Fix incorrect pagecache clearing behavior during FUNSHARE ops. - Don't allow log writes if the data device is readonly. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEUzaAxoMeQq6m2jMV+H93GTRKtOsFAmCRa+UACgkQ+H93GTRK tOvBLw/+PWgbb/sudVRk51f0bN0NgOBHM/pcW918Xo7TrASjxlRFeJit3TBvKiEi JqRdeUe8OPk6bhrCk1o1qo1zqK4BxDgsS6hn9/ruZAvG/Rh9oDyFQ9YTwvwRGCEs y8aALdlbrCT+4nQ/ORjWlZjTBuuj4N6sT2U21vtqmVjisFkVPhe5FH/Ntd1IXXOs FKVU3pC9SsAiEGWIEH+ZmB6ED1PIqFAqOEPDkP3t2UdN7iV3w1LaLBkYJcCHVZHT h2OX2bkmnDEuX2HKyMgJBOBrQtq/ZLunP+rfh8EjoBb7zBzToI6pAhH9dbmTarsM nV/lydkpSWdy3DIiANEGUpmIOShL5QRf2qwjEnew23scN52xDazZicPNPvEgU/YD EVvtOXbvVCzIs9ft3zMm6zhg3u/u07G7k3e08WO5x6SVe7ys5Z0Do7uESePC+3H+ n9IdN4+EP6RgNPKTRr1NlIuqTYc7wf63vj27QkBr0e7Q2vtoiquBOzrzWgINL90I AvLKrMsniMFBSKLayEhLSWXsm/1VxE2QiYRtfe4igMl4Nfu8dHXwezi4Awv70ibI tLf0Fjm2CK+CMP4SFa7hUzwQ29ZRqVE43ghlHqnZQtOVG1avZJ3mipIxXeO+O9pJ mOgJfZjud5TfsO2dUar1qr+efzCuZ4a/qfVjPlrh0LHJM2sRK5Y= =yoyk -----END PGP SIGNATURE----- Merge tag 'xfs-5.13-merge-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux Pull more xfs updates from Darrick Wong: "Except for the timestamp struct renaming patches, everything else in here are bug fixes: - Rename the log timestamp struct. - Remove broken transaction counter debugging that wasn't working correctly on very old filesystems. - Various fixes to make pre-lazysbcount filesystems work properly again. - Fix a free space accounting problem where we neglected to consider free space btree blocks that track metadata reservation space when deciding whether or not to allow caller to reserve space for a metadata update. - Fix incorrect pagecache clearing behavior during FUNSHARE ops. - Don't allow log writes if the data device is readonly" * tag 'xfs-5.13-merge-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: xfs: don't allow log writes if the data device is readonly xfs: fix xfs_reflink_unshare usage of filemap_write_and_wait_range xfs: set aside allocation btree blocks from block reservation xfs: introduce in-core global counter of allocbt blocks xfs: unconditionally read all AGFs on mounts with perag reservation xfs: count free space btree blocks when scrubbing pre-lazysbcount fses xfs: update superblock counters correctly for !lazysbcount xfs: don't check agf_btreeblks on pre-lazysbcount filesystems xfs: remove obsolete AGF counter debugging xfs: rename struct xfs_legacy_ictimestamp xfs: rename xfs_ictimestamp_t
This commit is contained in:
commit
af120709b1
@ -253,7 +253,8 @@ xfs_ag_resv_init(
|
||||
xfs_agnumber_t agno = pag->pag_agno;
|
||||
xfs_extlen_t ask;
|
||||
xfs_extlen_t used;
|
||||
int error = 0;
|
||||
int error = 0, error2;
|
||||
bool has_resv = false;
|
||||
|
||||
/* Create the metadata reservation. */
|
||||
if (pag->pag_meta_resv.ar_asked == 0) {
|
||||
@ -291,6 +292,8 @@ xfs_ag_resv_init(
|
||||
if (error)
|
||||
goto out;
|
||||
}
|
||||
if (ask)
|
||||
has_resv = true;
|
||||
}
|
||||
|
||||
/* Create the RMAPBT metadata reservation */
|
||||
@ -304,19 +307,28 @@ xfs_ag_resv_init(
|
||||
error = __xfs_ag_resv_init(pag, XFS_AG_RESV_RMAPBT, ask, used);
|
||||
if (error)
|
||||
goto out;
|
||||
if (ask)
|
||||
has_resv = true;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* need to read in the AGF for the ASSERT below to work */
|
||||
error = xfs_alloc_pagf_init(pag->pag_mount, tp, pag->pag_agno, 0);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
ASSERT(xfs_perag_resv(pag, XFS_AG_RESV_METADATA)->ar_reserved +
|
||||
xfs_perag_resv(pag, XFS_AG_RESV_RMAPBT)->ar_reserved <=
|
||||
pag->pagf_freeblks + pag->pagf_flcount);
|
||||
#endif
|
||||
out:
|
||||
/*
|
||||
* Initialize the pagf if we have at least one active reservation on the
|
||||
* AG. This may have occurred already via reservation calculation, but
|
||||
* fall back to an explicit init to ensure the in-core allocbt usage
|
||||
* counters are initialized as soon as possible. This is important
|
||||
* because filesystems with large perag reservations are susceptible to
|
||||
* free space reservation problems that the allocbt counter is used to
|
||||
* address.
|
||||
*/
|
||||
if (has_resv) {
|
||||
error2 = xfs_alloc_pagf_init(mp, tp, pag->pag_agno, 0);
|
||||
if (error2)
|
||||
return error2;
|
||||
ASSERT(xfs_perag_resv(pag, XFS_AG_RESV_METADATA)->ar_reserved +
|
||||
xfs_perag_resv(pag, XFS_AG_RESV_RMAPBT)->ar_reserved <=
|
||||
pag->pagf_freeblks + pag->pagf_flcount);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -718,7 +718,6 @@ xfs_alloc_update_counters(
|
||||
agbp->b_pag->pagf_freeblks += len;
|
||||
be32_add_cpu(&agf->agf_freeblks, len);
|
||||
|
||||
xfs_trans_agblocks_delta(tp, len);
|
||||
if (unlikely(be32_to_cpu(agf->agf_freeblks) >
|
||||
be32_to_cpu(agf->agf_length))) {
|
||||
xfs_buf_mark_corrupt(agbp);
|
||||
@ -2739,7 +2738,6 @@ xfs_alloc_get_freelist(
|
||||
pag = agbp->b_pag;
|
||||
ASSERT(!pag->pagf_agflreset);
|
||||
be32_add_cpu(&agf->agf_flcount, -1);
|
||||
xfs_trans_agflist_delta(tp, -1);
|
||||
pag->pagf_flcount--;
|
||||
|
||||
logflags = XFS_AGF_FLFIRST | XFS_AGF_FLCOUNT;
|
||||
@ -2846,7 +2844,6 @@ xfs_alloc_put_freelist(
|
||||
pag = agbp->b_pag;
|
||||
ASSERT(!pag->pagf_agflreset);
|
||||
be32_add_cpu(&agf->agf_flcount, 1);
|
||||
xfs_trans_agflist_delta(tp, 1);
|
||||
pag->pagf_flcount++;
|
||||
|
||||
logflags = XFS_AGF_FLLAST | XFS_AGF_FLCOUNT;
|
||||
@ -3036,6 +3033,7 @@ xfs_alloc_read_agf(
|
||||
struct xfs_agf *agf; /* ag freelist header */
|
||||
struct xfs_perag *pag; /* per allocation group data */
|
||||
int error;
|
||||
int allocbt_blks;
|
||||
|
||||
trace_xfs_alloc_read_agf(mp, agno);
|
||||
|
||||
@ -3066,6 +3064,19 @@ xfs_alloc_read_agf(
|
||||
pag->pagf_refcount_level = be32_to_cpu(agf->agf_refcount_level);
|
||||
pag->pagf_init = 1;
|
||||
pag->pagf_agflreset = xfs_agfl_needs_reset(mp, agf);
|
||||
|
||||
/*
|
||||
* Update the in-core allocbt counter. Filter out the rmapbt
|
||||
* subset of the btreeblks counter because the rmapbt is managed
|
||||
* by perag reservation. Subtract one for the rmapbt root block
|
||||
* because the rmap counter includes it while the btreeblks
|
||||
* counter only tracks non-root blocks.
|
||||
*/
|
||||
allocbt_blks = pag->pagf_btreeblks;
|
||||
if (xfs_sb_version_hasrmapbt(&mp->m_sb))
|
||||
allocbt_blks -= be32_to_cpu(agf->agf_rmap_blocks) - 1;
|
||||
if (allocbt_blks > 0)
|
||||
atomic64_add(allocbt_blks, &mp->m_allocbt_blks);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else if (!XFS_FORCED_SHUTDOWN(mp)) {
|
||||
|
@ -71,9 +71,9 @@ xfs_allocbt_alloc_block(
|
||||
return 0;
|
||||
}
|
||||
|
||||
atomic64_inc(&cur->bc_mp->m_allocbt_blks);
|
||||
xfs_extent_busy_reuse(cur->bc_mp, cur->bc_ag.agno, bno, 1, false);
|
||||
|
||||
xfs_trans_agbtree_delta(cur->bc_tp, 1);
|
||||
new->s = cpu_to_be32(bno);
|
||||
|
||||
*stat = 1;
|
||||
@ -95,9 +95,9 @@ xfs_allocbt_free_block(
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
atomic64_dec(&cur->bc_mp->m_allocbt_blks);
|
||||
xfs_extent_busy_insert(cur->bc_tp, be32_to_cpu(agf->agf_seqno), bno, 1,
|
||||
XFS_EXTENT_BUSY_SKIP_DISCARD);
|
||||
xfs_trans_agbtree_delta(cur->bc_tp, -1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -368,10 +368,10 @@ static inline int xfs_ilog_fdata(int w)
|
||||
* directly mirrors the xfs_dinode structure as it must contain all the same
|
||||
* information.
|
||||
*/
|
||||
typedef uint64_t xfs_ictimestamp_t;
|
||||
typedef uint64_t xfs_log_timestamp_t;
|
||||
|
||||
/* Legacy timestamp encoding format. */
|
||||
struct xfs_legacy_ictimestamp {
|
||||
struct xfs_log_legacy_timestamp {
|
||||
int32_t t_sec; /* timestamp seconds */
|
||||
int32_t t_nsec; /* timestamp nanoseconds */
|
||||
};
|
||||
@ -393,9 +393,9 @@ struct xfs_log_dinode {
|
||||
uint16_t di_projid_hi; /* higher part of owner's project id */
|
||||
uint8_t di_pad[6]; /* unused, zeroed space */
|
||||
uint16_t di_flushiter; /* incremented on flush */
|
||||
xfs_ictimestamp_t di_atime; /* time last accessed */
|
||||
xfs_ictimestamp_t di_mtime; /* time last modified */
|
||||
xfs_ictimestamp_t di_ctime; /* time created/inode modified */
|
||||
xfs_log_timestamp_t di_atime; /* time last accessed */
|
||||
xfs_log_timestamp_t di_mtime; /* time last modified */
|
||||
xfs_log_timestamp_t di_ctime; /* time created/inode modified */
|
||||
xfs_fsize_t di_size; /* number of bytes in file */
|
||||
xfs_rfsblock_t di_nblocks; /* # of direct & btree blocks used */
|
||||
xfs_extlen_t di_extsize; /* basic/minimum extent size for file */
|
||||
@ -420,7 +420,7 @@ struct xfs_log_dinode {
|
||||
uint8_t di_pad2[12]; /* more padding for future expansion */
|
||||
|
||||
/* fields only written to during inode creation */
|
||||
xfs_ictimestamp_t di_crtime; /* time created */
|
||||
xfs_log_timestamp_t di_crtime; /* time created */
|
||||
xfs_ino_t di_ino; /* inode number */
|
||||
uuid_t di_uuid; /* UUID of the filesystem */
|
||||
|
||||
|
@ -103,7 +103,6 @@ xfs_rmapbt_alloc_block(
|
||||
xfs_extent_busy_reuse(cur->bc_mp, cur->bc_ag.agno, bno, 1,
|
||||
false);
|
||||
|
||||
xfs_trans_agbtree_delta(cur->bc_tp, 1);
|
||||
new->s = cpu_to_be32(bno);
|
||||
be32_add_cpu(&agf->agf_rmap_blocks, 1);
|
||||
xfs_alloc_log_agf(cur->bc_tp, agbp, XFS_AGF_RMAP_BLOCKS);
|
||||
@ -136,7 +135,6 @@ xfs_rmapbt_free_block(
|
||||
|
||||
xfs_extent_busy_insert(cur->bc_tp, be32_to_cpu(agf->agf_seqno), bno, 1,
|
||||
XFS_EXTENT_BUSY_SKIP_DISCARD);
|
||||
xfs_trans_agbtree_delta(cur->bc_tp, -1);
|
||||
|
||||
pag = cur->bc_ag.agbp->b_pag;
|
||||
xfs_ag_resv_free_extent(pag, XFS_AG_RESV_RMAPBT, NULL, 1);
|
||||
|
@ -926,9 +926,19 @@ xfs_log_sb(
|
||||
struct xfs_mount *mp = tp->t_mountp;
|
||||
struct xfs_buf *bp = xfs_trans_getsb(tp);
|
||||
|
||||
mp->m_sb.sb_icount = percpu_counter_sum(&mp->m_icount);
|
||||
mp->m_sb.sb_ifree = percpu_counter_sum(&mp->m_ifree);
|
||||
mp->m_sb.sb_fdblocks = percpu_counter_sum(&mp->m_fdblocks);
|
||||
/*
|
||||
* Lazy sb counters don't update the in-core superblock so do that now.
|
||||
* If this is at unmount, the counters will be exactly correct, but at
|
||||
* any other time they will only be ballpark correct because of
|
||||
* reservations that have been taken out percpu counters. If we have an
|
||||
* unclean shutdown, this will be corrected by log recovery rebuilding
|
||||
* the counters from the AGF block counts.
|
||||
*/
|
||||
if (xfs_sb_version_haslazysbcount(&mp->m_sb)) {
|
||||
mp->m_sb.sb_icount = percpu_counter_sum(&mp->m_icount);
|
||||
mp->m_sb.sb_ifree = percpu_counter_sum(&mp->m_ifree);
|
||||
mp->m_sb.sb_fdblocks = percpu_counter_sum(&mp->m_fdblocks);
|
||||
}
|
||||
|
||||
xfs_sb_to_disk(bp->b_addr, &mp->m_sb);
|
||||
xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SB_BUF);
|
||||
|
@ -416,6 +416,10 @@ xchk_agf_xref_btreeblks(
|
||||
xfs_agblock_t btreeblks;
|
||||
int error;
|
||||
|
||||
/* agf_btreeblks didn't exist before lazysbcount */
|
||||
if (!xfs_sb_version_haslazysbcount(&sc->mp->m_sb))
|
||||
return;
|
||||
|
||||
/* Check agf_rmap_blocks; set up for agf_btreeblks check */
|
||||
if (sc->sa.rmap_cur) {
|
||||
error = xfs_btree_count_blocks(sc->sa.rmap_cur, &blocks);
|
||||
@ -581,7 +585,8 @@ xchk_agf(
|
||||
xchk_block_set_corrupt(sc, sc->sa.agf_bp);
|
||||
if (pag->pagf_flcount != be32_to_cpu(agf->agf_flcount))
|
||||
xchk_block_set_corrupt(sc, sc->sa.agf_bp);
|
||||
if (pag->pagf_btreeblks != be32_to_cpu(agf->agf_btreeblks))
|
||||
if (xfs_sb_version_haslazysbcount(&sc->mp->m_sb) &&
|
||||
pag->pagf_btreeblks != be32_to_cpu(agf->agf_btreeblks))
|
||||
xchk_block_set_corrupt(sc, sc->sa.agf_bp);
|
||||
xfs_perag_put(pag);
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "xfs_alloc.h"
|
||||
#include "xfs_ialloc.h"
|
||||
#include "xfs_health.h"
|
||||
#include "xfs_btree.h"
|
||||
#include "scrub/scrub.h"
|
||||
#include "scrub/common.h"
|
||||
#include "scrub/trace.h"
|
||||
@ -143,6 +144,35 @@ xchk_setup_fscounters(
|
||||
return xchk_trans_alloc(sc, 0);
|
||||
}
|
||||
|
||||
/* Count free space btree blocks manually for pre-lazysbcount filesystems. */
|
||||
static int
|
||||
xchk_fscount_btreeblks(
|
||||
struct xfs_scrub *sc,
|
||||
struct xchk_fscounters *fsc,
|
||||
xfs_agnumber_t agno)
|
||||
{
|
||||
xfs_extlen_t blocks;
|
||||
int error;
|
||||
|
||||
error = xchk_ag_init(sc, agno, &sc->sa);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
error = xfs_btree_count_blocks(sc->sa.bno_cur, &blocks);
|
||||
if (error)
|
||||
goto out_free;
|
||||
fsc->fdblocks += blocks - 1;
|
||||
|
||||
error = xfs_btree_count_blocks(sc->sa.cnt_cur, &blocks);
|
||||
if (error)
|
||||
goto out_free;
|
||||
fsc->fdblocks += blocks - 1;
|
||||
|
||||
out_free:
|
||||
xchk_ag_free(sc, &sc->sa);
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate what the global in-core counters ought to be from the incore
|
||||
* per-AG structure. Callers can compare this to the actual in-core counters
|
||||
@ -182,7 +212,15 @@ retry:
|
||||
/* Add up the free/freelist/bnobt/cntbt blocks */
|
||||
fsc->fdblocks += pag->pagf_freeblks;
|
||||
fsc->fdblocks += pag->pagf_flcount;
|
||||
fsc->fdblocks += pag->pagf_btreeblks;
|
||||
if (xfs_sb_version_haslazysbcount(&sc->mp->m_sb)) {
|
||||
fsc->fdblocks += pag->pagf_btreeblks;
|
||||
} else {
|
||||
error = xchk_fscount_btreeblks(sc, fsc, agno);
|
||||
if (error) {
|
||||
xfs_perag_put(pag);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Per-AG reservations are taken out of the incore counters,
|
||||
|
@ -69,8 +69,6 @@ xfs_resizefs_init_new_ags(
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
xfs_trans_agblocks_delta(tp, id->nfree);
|
||||
|
||||
if (delta) {
|
||||
*lastag_extended = true;
|
||||
error = xfs_ag_extend_space(mp, tp, id, delta);
|
||||
|
@ -299,18 +299,18 @@ xfs_inode_item_format_attr_fork(
|
||||
* Convert an incore timestamp to a log timestamp. Note that the log format
|
||||
* specifies host endian format!
|
||||
*/
|
||||
static inline xfs_ictimestamp_t
|
||||
static inline xfs_log_timestamp_t
|
||||
xfs_inode_to_log_dinode_ts(
|
||||
struct xfs_inode *ip,
|
||||
const struct timespec64 tv)
|
||||
{
|
||||
struct xfs_legacy_ictimestamp *lits;
|
||||
xfs_ictimestamp_t its;
|
||||
struct xfs_log_legacy_timestamp *lits;
|
||||
xfs_log_timestamp_t its;
|
||||
|
||||
if (xfs_inode_has_bigtime(ip))
|
||||
return xfs_inode_encode_bigtime(tv);
|
||||
|
||||
lits = (struct xfs_legacy_ictimestamp *)&its;
|
||||
lits = (struct xfs_log_legacy_timestamp *)&its;
|
||||
lits->t_sec = tv.tv_sec;
|
||||
lits->t_nsec = tv.tv_nsec;
|
||||
|
||||
|
@ -125,17 +125,17 @@ static inline bool xfs_log_dinode_has_bigtime(const struct xfs_log_dinode *ld)
|
||||
static inline xfs_timestamp_t
|
||||
xfs_log_dinode_to_disk_ts(
|
||||
struct xfs_log_dinode *from,
|
||||
const xfs_ictimestamp_t its)
|
||||
const xfs_log_timestamp_t its)
|
||||
{
|
||||
struct xfs_legacy_timestamp *lts;
|
||||
struct xfs_legacy_ictimestamp *lits;
|
||||
struct xfs_log_legacy_timestamp *lits;
|
||||
xfs_timestamp_t ts;
|
||||
|
||||
if (xfs_log_dinode_has_bigtime(from))
|
||||
return cpu_to_be64(its);
|
||||
|
||||
lts = (struct xfs_legacy_timestamp *)&ts;
|
||||
lits = (struct xfs_legacy_ictimestamp *)&its;
|
||||
lits = (struct xfs_log_legacy_timestamp *)&its;
|
||||
lts->t_sec = cpu_to_be32(lits->t_sec);
|
||||
lts->t_nsec = cpu_to_be32(lits->t_nsec);
|
||||
|
||||
|
@ -355,13 +355,15 @@ xfs_log_writable(
|
||||
struct xfs_mount *mp)
|
||||
{
|
||||
/*
|
||||
* Never write to the log on norecovery mounts, if the block device is
|
||||
* read-only, or if the filesystem is shutdown. Read-only mounts still
|
||||
* allow internal writes for log recovery and unmount purposes, so don't
|
||||
* restrict that case here.
|
||||
* Do not write to the log on norecovery mounts, if the data or log
|
||||
* devices are read-only, or if the filesystem is shutdown. Read-only
|
||||
* mounts allow internal writes for log recovery and unmount purposes,
|
||||
* so don't restrict that case.
|
||||
*/
|
||||
if (mp->m_flags & XFS_MOUNT_NORECOVERY)
|
||||
return false;
|
||||
if (xfs_readonly_buftarg(mp->m_ddev_targp))
|
||||
return false;
|
||||
if (xfs_readonly_buftarg(mp->m_log->l_targ))
|
||||
return false;
|
||||
if (XFS_FORCED_SHUTDOWN(mp))
|
||||
|
@ -1188,6 +1188,7 @@ xfs_mod_fdblocks(
|
||||
int64_t lcounter;
|
||||
long long res_used;
|
||||
s32 batch;
|
||||
uint64_t set_aside;
|
||||
|
||||
if (delta > 0) {
|
||||
/*
|
||||
@ -1227,8 +1228,20 @@ xfs_mod_fdblocks(
|
||||
else
|
||||
batch = XFS_FDBLOCKS_BATCH;
|
||||
|
||||
/*
|
||||
* Set aside allocbt blocks because these blocks are tracked as free
|
||||
* space but not available for allocation. Technically this means that a
|
||||
* single reservation cannot consume all remaining free space, but the
|
||||
* ratio of allocbt blocks to usable free blocks should be rather small.
|
||||
* The tradeoff without this is that filesystems that maintain high
|
||||
* perag block reservations can over reserve physical block availability
|
||||
* and fail physical allocation, which leads to much more serious
|
||||
* problems (i.e. transaction abort, pagecache discards, etc.) than
|
||||
* slightly premature -ENOSPC.
|
||||
*/
|
||||
set_aside = mp->m_alloc_set_aside + atomic64_read(&mp->m_allocbt_blks);
|
||||
percpu_counter_add_batch(&mp->m_fdblocks, delta, batch);
|
||||
if (__percpu_counter_compare(&mp->m_fdblocks, mp->m_alloc_set_aside,
|
||||
if (__percpu_counter_compare(&mp->m_fdblocks, set_aside,
|
||||
XFS_FDBLOCKS_BATCH) >= 0) {
|
||||
/* we had space! */
|
||||
return 0;
|
||||
|
@ -170,6 +170,12 @@ typedef struct xfs_mount {
|
||||
* extents or anything related to the rt device.
|
||||
*/
|
||||
struct percpu_counter m_delalloc_blks;
|
||||
/*
|
||||
* Global count of allocation btree blocks in use across all AGs. Only
|
||||
* used when perag reservation is enabled. Helps prevent block
|
||||
* reservation from attempting to reserve allocation btree blocks.
|
||||
*/
|
||||
atomic64_t m_allocbt_blks;
|
||||
|
||||
struct radix_tree_root m_perag_tree; /* per-ag accounting info */
|
||||
spinlock_t m_perag_lock; /* lock for m_perag_tree */
|
||||
|
@ -126,8 +126,8 @@ xfs_check_ondisk_structs(void)
|
||||
XFS_CHECK_STRUCT_SIZE(struct xfs_extent_64, 16);
|
||||
XFS_CHECK_STRUCT_SIZE(struct xfs_log_dinode, 176);
|
||||
XFS_CHECK_STRUCT_SIZE(struct xfs_icreate_log, 28);
|
||||
XFS_CHECK_STRUCT_SIZE(xfs_ictimestamp_t, 8);
|
||||
XFS_CHECK_STRUCT_SIZE(struct xfs_legacy_ictimestamp, 8);
|
||||
XFS_CHECK_STRUCT_SIZE(xfs_log_timestamp_t, 8);
|
||||
XFS_CHECK_STRUCT_SIZE(struct xfs_log_legacy_timestamp, 8);
|
||||
XFS_CHECK_STRUCT_SIZE(struct xfs_inode_log_format_32, 52);
|
||||
XFS_CHECK_STRUCT_SIZE(struct xfs_inode_log_format, 56);
|
||||
XFS_CHECK_STRUCT_SIZE(struct xfs_qoff_logformat, 20);
|
||||
|
@ -1522,7 +1522,8 @@ xfs_reflink_unshare(
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
error = filemap_write_and_wait_range(inode->i_mapping, offset, len);
|
||||
error = filemap_write_and_wait_range(inode->i_mapping, offset,
|
||||
offset + len - 1);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
|
@ -487,13 +487,6 @@ xfs_trans_apply_sb_deltas(
|
||||
bp = xfs_trans_getsb(tp);
|
||||
sbp = bp->b_addr;
|
||||
|
||||
/*
|
||||
* Check that superblock mods match the mods made to AGF counters.
|
||||
*/
|
||||
ASSERT((tp->t_fdblocks_delta + tp->t_res_fdblocks_delta) ==
|
||||
(tp->t_ag_freeblks_delta + tp->t_ag_flist_delta +
|
||||
tp->t_ag_btree_delta));
|
||||
|
||||
/*
|
||||
* Only update the superblock counters if we are logging them
|
||||
*/
|
||||
@ -629,6 +622,9 @@ xfs_trans_unreserve_and_mod_sb(
|
||||
|
||||
/* apply remaining deltas */
|
||||
spin_lock(&mp->m_sb_lock);
|
||||
mp->m_sb.sb_fdblocks += tp->t_fdblocks_delta + tp->t_res_fdblocks_delta;
|
||||
mp->m_sb.sb_icount += idelta;
|
||||
mp->m_sb.sb_ifree += ifreedelta;
|
||||
mp->m_sb.sb_frextents += rtxdelta;
|
||||
mp->m_sb.sb_dblocks += tp->t_dblocks_delta;
|
||||
mp->m_sb.sb_agcount += tp->t_agcount_delta;
|
||||
|
@ -140,11 +140,6 @@ typedef struct xfs_trans {
|
||||
int64_t t_res_fdblocks_delta; /* on-disk only chg */
|
||||
int64_t t_frextents_delta;/* superblock freextents chg*/
|
||||
int64_t t_res_frextents_delta; /* on-disk only chg */
|
||||
#if defined(DEBUG) || defined(XFS_WARN)
|
||||
int64_t t_ag_freeblks_delta; /* debugging counter */
|
||||
int64_t t_ag_flist_delta; /* debugging counter */
|
||||
int64_t t_ag_btree_delta; /* debugging counter */
|
||||
#endif
|
||||
int64_t t_dblocks_delta;/* superblock dblocks change */
|
||||
int64_t t_agcount_delta;/* superblock agcount change */
|
||||
int64_t t_imaxpct_delta;/* superblock imaxpct change */
|
||||
@ -165,16 +160,6 @@ typedef struct xfs_trans {
|
||||
*/
|
||||
#define xfs_trans_set_sync(tp) ((tp)->t_flags |= XFS_TRANS_SYNC)
|
||||
|
||||
#if defined(DEBUG) || defined(XFS_WARN)
|
||||
#define xfs_trans_agblocks_delta(tp, d) ((tp)->t_ag_freeblks_delta += (int64_t)d)
|
||||
#define xfs_trans_agflist_delta(tp, d) ((tp)->t_ag_flist_delta += (int64_t)d)
|
||||
#define xfs_trans_agbtree_delta(tp, d) ((tp)->t_ag_btree_delta += (int64_t)d)
|
||||
#else
|
||||
#define xfs_trans_agblocks_delta(tp, d)
|
||||
#define xfs_trans_agflist_delta(tp, d)
|
||||
#define xfs_trans_agbtree_delta(tp, d)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XFS transaction mechanism exported interfaces.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user