xfs: changes for 6.1-rc1
This update contains: - fixes for filesystem shutdown procedure during a DAX memory failure notification - bug fixes - logic cleanups - log message cleanups - updates to use vfs{g,u}id_t helpers where appropriate Signed-off-by: Dave Chinner <david@fromorbit.com> -----BEGIN PGP SIGNATURE----- iQJIBAABCgAyFiEEmJOoJ8GffZYWSjj/regpR/R1+h0FAmNEjOoUHGRhdmlkQGZy b21vcmJpdC5jb20ACgkQregpR/R1+h2UNg/+Ib1V1XSL6g+sidIPlm5/J3U2sWTh gRPgd5f5U25T50TEuor93RcOBMXTEww5tsRkQLmekzzgRiCcXu24VyzfCsbx9u4o JrWt7po+NXPtJW8VedNdHVlOiMBQsf1u3ZY54nmv63EW69J/BEK9jTUeGy3rK0DY +A/wVvVDipp8VZZ5zh/SwQh1pp3CSSElwuVdlcRl5cJiKiD2vg+Z/NvHnrp+1u+9 F6rOW6RFjU9PqfNGhx9RjC+pYVlmVrDUwHj680ReDsdgDOWzbnW05ft74JpRdGfC tEy9vxjQ8/3/7vTHspXCI4RIn9LrBjNke2eRgsdRqVcjHa2KQ+hUvG6v8sxV+Wms 7N1oIS2IKtLhUGOZyCwgUCLKFQ1blfkF/XyKx9DFumsnMLzmG2ret9DuOBPccr+c o7e1ArIlgnJpre2nvPhF5EcM+dArVMuZGPG03vL1iS7A79Ak0/e8Jivee1ScdupP yNJZzBYYbCkpIUVD9wzNeziSwwSXgW9j1nr6HEOLpBAa0/v0OS5iZfjWVvSLK24Q OcstRkY7cV5LkU2weIK6UQ6KZF4lJxUQ9j50OeeTuy3fou3utUt0vgVEGIiZ/edp H0gnQ15wT/RFjOL3i9zMhh24Yy25E/df1ugYmrOwszOQxU21KuZhvzhhehD5pC+r 3MyQQ/e99VoDzEw= =2o9v -----END PGP SIGNATURE----- Merge tag 'xfs-6.1-for-linus' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux Pull xfs updates from Dave Chinner: "There are relatively few updates this cycle; half the cycle was eaten by a grue, the other half was eaten by a tricky data corruption issue that I still haven't entirely solved. Hence there's no major changes in this cycle and it's largely just minor cleanups and small bug fixes: - fixes for filesystem shutdown procedure during a DAX memory failure notification - bug fixes - logic cleanups - log message cleanups - updates to use vfs{g,u}id_t helpers where appropriate" * tag 'xfs-6.1-for-linus' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: xfs: on memory failure, only shut down fs after scanning all mappings xfs: rearrange the logic and remove the broken comment for xfs_dir2_isxx xfs: trim the mapp array accordingly in xfs_da_grow_inode_int xfs: do not need to check return value of xlog_kvmalloc() xfs: port to vfs{g,u}id_t and associated helpers xfs: remove xfs_setattr_time() declaration xfs: Remove the unneeded result variable xfs: missing space in xfs trace log xfs: simplify if-else condition in xfs_reflink_trim_around_shared xfs: simplify if-else condition in xfs_validate_new_dalign xfs: replace unnecessary seq_printf with seq_puts xfs: clean up "%Ld/%Lu" which doesn't meet C standard xfs: remove redundant else for clean code xfs: remove the redundant word in comment
This commit is contained in:
commit
60bb8154d1
@ -294,7 +294,7 @@ xfs_check_block(
|
||||
else
|
||||
thispa = XFS_BMBT_PTR_ADDR(mp, block, j, dmxr);
|
||||
if (*thispa == *pp) {
|
||||
xfs_warn(mp, "%s: thispa(%d) == pp(%d) %Ld",
|
||||
xfs_warn(mp, "%s: thispa(%d) == pp(%d) %lld",
|
||||
__func__, j, i,
|
||||
(unsigned long long)be64_to_cpu(*thispa));
|
||||
xfs_err(mp, "%s: ptrs are equal in node\n",
|
||||
|
@ -2192,8 +2192,8 @@ xfs_da_grow_inode_int(
|
||||
*/
|
||||
mapp = kmem_alloc(sizeof(*mapp) * count, 0);
|
||||
for (b = *bno, mapi = 0; b < *bno + count; ) {
|
||||
nmap = min(XFS_BMAP_MAX_NMAP, count);
|
||||
c = (int)(*bno + count - b);
|
||||
nmap = min(XFS_BMAP_MAX_NMAP, c);
|
||||
error = xfs_bmapi_write(tp, dp, b, c,
|
||||
xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA,
|
||||
args->total, &mapp[mapi], &nmap);
|
||||
|
@ -261,7 +261,7 @@ xfs_dir_createname(
|
||||
{
|
||||
struct xfs_da_args *args;
|
||||
int rval;
|
||||
int v; /* type-checking value */
|
||||
bool v;
|
||||
|
||||
ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
|
||||
|
||||
@ -357,7 +357,7 @@ xfs_dir_lookup(
|
||||
{
|
||||
struct xfs_da_args *args;
|
||||
int rval;
|
||||
int v; /* type-checking value */
|
||||
bool v;
|
||||
int lock_mode;
|
||||
|
||||
ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
|
||||
@ -435,7 +435,7 @@ xfs_dir_removename(
|
||||
{
|
||||
struct xfs_da_args *args;
|
||||
int rval;
|
||||
int v; /* type-checking value */
|
||||
bool v;
|
||||
|
||||
ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
|
||||
XFS_STATS_INC(dp->i_mount, xs_dir_remove);
|
||||
@ -493,7 +493,7 @@ xfs_dir_replace(
|
||||
{
|
||||
struct xfs_da_args *args;
|
||||
int rval;
|
||||
int v; /* type-checking value */
|
||||
bool v;
|
||||
|
||||
ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
|
||||
|
||||
@ -610,19 +610,23 @@ xfs_dir2_grow_inode(
|
||||
int
|
||||
xfs_dir2_isblock(
|
||||
struct xfs_da_args *args,
|
||||
int *vp) /* out: 1 is block, 0 is not block */
|
||||
bool *isblock)
|
||||
{
|
||||
xfs_fileoff_t last; /* last file offset */
|
||||
int rval;
|
||||
struct xfs_mount *mp = args->dp->i_mount;
|
||||
xfs_fileoff_t eof;
|
||||
int error;
|
||||
|
||||
if ((rval = xfs_bmap_last_offset(args->dp, &last, XFS_DATA_FORK)))
|
||||
return rval;
|
||||
rval = XFS_FSB_TO_B(args->dp->i_mount, last) == args->geo->blksize;
|
||||
if (XFS_IS_CORRUPT(args->dp->i_mount,
|
||||
rval != 0 &&
|
||||
args->dp->i_disk_size != args->geo->blksize))
|
||||
error = xfs_bmap_last_offset(args->dp, &eof, XFS_DATA_FORK);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
*isblock = false;
|
||||
if (XFS_FSB_TO_B(mp, eof) != args->geo->blksize)
|
||||
return 0;
|
||||
|
||||
*isblock = true;
|
||||
if (XFS_IS_CORRUPT(mp, args->dp->i_disk_size != args->geo->blksize))
|
||||
return -EFSCORRUPTED;
|
||||
*vp = rval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -632,14 +636,20 @@ xfs_dir2_isblock(
|
||||
int
|
||||
xfs_dir2_isleaf(
|
||||
struct xfs_da_args *args,
|
||||
int *vp) /* out: 1 is block, 0 is not block */
|
||||
bool *isleaf)
|
||||
{
|
||||
xfs_fileoff_t last; /* last file offset */
|
||||
int rval;
|
||||
xfs_fileoff_t eof;
|
||||
int error;
|
||||
|
||||
if ((rval = xfs_bmap_last_offset(args->dp, &last, XFS_DATA_FORK)))
|
||||
return rval;
|
||||
*vp = last == args->geo->leafblk + args->geo->fsbcount;
|
||||
error = xfs_bmap_last_offset(args->dp, &eof, XFS_DATA_FORK);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
*isleaf = false;
|
||||
if (eof != args->geo->leafblk + args->geo->fsbcount)
|
||||
return 0;
|
||||
|
||||
*isleaf = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -61,8 +61,8 @@ extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);
|
||||
/*
|
||||
* Interface routines used by userspace utilities
|
||||
*/
|
||||
extern int xfs_dir2_isblock(struct xfs_da_args *args, int *r);
|
||||
extern int xfs_dir2_isleaf(struct xfs_da_args *args, int *r);
|
||||
extern int xfs_dir2_isblock(struct xfs_da_args *args, bool *isblock);
|
||||
extern int xfs_dir2_isleaf(struct xfs_da_args *args, bool *isleaf);
|
||||
extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
|
||||
struct xfs_buf *bp);
|
||||
|
||||
|
@ -865,7 +865,6 @@ xfs_dir2_sf_lookup(
|
||||
struct xfs_inode *dp = args->dp;
|
||||
struct xfs_mount *mp = dp->i_mount;
|
||||
int i; /* entry index */
|
||||
int error;
|
||||
xfs_dir2_sf_entry_t *sfep; /* shortform directory entry */
|
||||
xfs_dir2_sf_hdr_t *sfp; /* shortform structure */
|
||||
enum xfs_dacmp cmp; /* comparison result */
|
||||
@ -929,8 +928,7 @@ xfs_dir2_sf_lookup(
|
||||
if (!ci_sfep)
|
||||
return -ENOENT;
|
||||
/* otherwise process the CI match as required by the caller */
|
||||
error = xfs_dir_cilookup_result(args, ci_sfep->name, ci_sfep->namelen);
|
||||
return error;
|
||||
return xfs_dir_cilookup_result(args, ci_sfep->name, ci_sfep->namelen);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -78,7 +78,7 @@ xfs_iformat_local(
|
||||
*/
|
||||
if (unlikely(size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) {
|
||||
xfs_warn(ip->i_mount,
|
||||
"corrupt inode %Lu (bad size %d for local fork, size = %zd).",
|
||||
"corrupt inode %llu (bad size %d for local fork, size = %zd).",
|
||||
(unsigned long long) ip->i_ino, size,
|
||||
XFS_DFORK_SIZE(dip, ip->i_mount, whichfork));
|
||||
xfs_inode_verifier_error(ip, -EFSCORRUPTED,
|
||||
@ -192,7 +192,7 @@ xfs_iformat_btree(
|
||||
XFS_DFORK_SIZE(dip, mp, whichfork) ||
|
||||
ifp->if_nextents > ip->i_nblocks) ||
|
||||
level == 0 || level > XFS_BM_MAXLEVELS(mp, whichfork)) {
|
||||
xfs_warn(mp, "corrupt inode %Lu (btree).",
|
||||
xfs_warn(mp, "corrupt inode %llu (btree).",
|
||||
(unsigned long long) ip->i_ino);
|
||||
xfs_inode_verifier_error(ip, -EFSCORRUPTED,
|
||||
"xfs_iformat_btree", dfp, size,
|
||||
|
@ -676,7 +676,7 @@ xchk_directory_blocks(
|
||||
xfs_dablk_t dabno;
|
||||
xfs_dir2_db_t last_data_db = 0;
|
||||
bool found;
|
||||
int is_block = 0;
|
||||
bool is_block = false;
|
||||
int error;
|
||||
|
||||
/* Ignore local format directories. */
|
||||
|
@ -86,8 +86,6 @@ xfs_attri_log_nameval_alloc(
|
||||
*/
|
||||
nv = xlog_kvmalloc(sizeof(struct xfs_attri_log_nameval) +
|
||||
name_len + value_len);
|
||||
if (!nv)
|
||||
return nv;
|
||||
|
||||
nv->name.i_addr = nv + 1;
|
||||
nv->name.i_len = name_len;
|
||||
@ -441,8 +439,6 @@ xfs_attr_create_intent(
|
||||
attr->xattri_nameval = xfs_attri_log_nameval_alloc(args->name,
|
||||
args->namelen, args->value, args->valuelen);
|
||||
}
|
||||
if (!attr->xattri_nameval)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
attrip = xfs_attri_init(mp, attr->xattri_nameval);
|
||||
xfs_trans_add_item(tp, &attrip->attri_item);
|
||||
@ -762,8 +758,6 @@ xlog_recover_attri_commit_pass2(
|
||||
nv = xfs_attri_log_nameval_alloc(attr_name,
|
||||
attri_formatp->alfi_name_len, attr_value,
|
||||
attri_formatp->alfi_value_len);
|
||||
if (!nv)
|
||||
return -ENOMEM;
|
||||
|
||||
attrip = xfs_attri_init(mp, nv);
|
||||
error = xfs_attri_copy_format(&item->ri_buf[0], &attrip->attri_format);
|
||||
|
@ -512,7 +512,7 @@ xfs_readdir(
|
||||
{
|
||||
struct xfs_da_args args = { NULL };
|
||||
unsigned int lock_mode;
|
||||
int isblock;
|
||||
bool isblock;
|
||||
int error;
|
||||
|
||||
trace_xfs_readdir(dp);
|
||||
|
@ -835,9 +835,8 @@ xfs_init_new_inode(
|
||||
* ID or one of the supplementary group IDs, the S_ISGID bit is cleared
|
||||
* (and only if the irix_sgid_inherit compatibility variable is set).
|
||||
*/
|
||||
if (irix_sgid_inherit &&
|
||||
(inode->i_mode & S_ISGID) &&
|
||||
!in_group_p(i_gid_into_mnt(mnt_userns, inode)))
|
||||
if (irix_sgid_inherit && (inode->i_mode & S_ISGID) &&
|
||||
!vfsgid_in_group_p(i_gid_into_vfsgid(mnt_userns, inode)))
|
||||
inode->i_mode &= ~S_ISGID;
|
||||
|
||||
ip->i_disk_size = 0;
|
||||
@ -3119,7 +3118,7 @@ xfs_iflush(
|
||||
if (XFS_TEST_ERROR(dip->di_magic != cpu_to_be16(XFS_DINODE_MAGIC),
|
||||
mp, XFS_ERRTAG_IFLUSH_1)) {
|
||||
xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
|
||||
"%s: Bad inode %Lu magic number 0x%x, ptr "PTR_FMT,
|
||||
"%s: Bad inode %llu magic number 0x%x, ptr "PTR_FMT,
|
||||
__func__, ip->i_ino, be16_to_cpu(dip->di_magic), dip);
|
||||
goto flush_out;
|
||||
}
|
||||
@ -3129,7 +3128,7 @@ xfs_iflush(
|
||||
ip->i_df.if_format != XFS_DINODE_FMT_BTREE,
|
||||
mp, XFS_ERRTAG_IFLUSH_3)) {
|
||||
xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
|
||||
"%s: Bad regular inode %Lu, ptr "PTR_FMT,
|
||||
"%s: Bad regular inode %llu, ptr "PTR_FMT,
|
||||
__func__, ip->i_ino, ip);
|
||||
goto flush_out;
|
||||
}
|
||||
@ -3140,7 +3139,7 @@ xfs_iflush(
|
||||
ip->i_df.if_format != XFS_DINODE_FMT_LOCAL,
|
||||
mp, XFS_ERRTAG_IFLUSH_4)) {
|
||||
xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
|
||||
"%s: Bad directory inode %Lu, ptr "PTR_FMT,
|
||||
"%s: Bad directory inode %llu, ptr "PTR_FMT,
|
||||
__func__, ip->i_ino, ip);
|
||||
goto flush_out;
|
||||
}
|
||||
@ -3158,7 +3157,7 @@ xfs_iflush(
|
||||
if (XFS_TEST_ERROR(ip->i_forkoff > mp->m_sb.sb_inodesize,
|
||||
mp, XFS_ERRTAG_IFLUSH_6)) {
|
||||
xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
|
||||
"%s: bad inode %Lu, forkoff 0x%x, ptr "PTR_FMT,
|
||||
"%s: bad inode %llu, forkoff 0x%x, ptr "PTR_FMT,
|
||||
__func__, ip->i_ino, ip->i_forkoff, ip);
|
||||
goto flush_out;
|
||||
}
|
||||
|
@ -550,7 +550,7 @@ xfs_inode_item_push(
|
||||
|
||||
if (!bp || (ip->i_flags & XFS_ISTALE)) {
|
||||
/*
|
||||
* Inode item/buffer is being being aborted due to cluster
|
||||
* Inode item/buffer is being aborted due to cluster
|
||||
* buffer deletion. Trigger a log force to have that operation
|
||||
* completed and items removed from the AIL before the next push
|
||||
* attempt.
|
||||
|
@ -321,7 +321,7 @@ xlog_recover_inode_commit_pass2(
|
||||
*/
|
||||
if (XFS_IS_CORRUPT(mp, !xfs_verify_magic16(bp, dip->di_magic))) {
|
||||
xfs_alert(mp,
|
||||
"%s: Bad inode magic number, dip = "PTR_FMT", dino bp = "PTR_FMT", ino = %Ld",
|
||||
"%s: Bad inode magic number, dip = "PTR_FMT", dino bp = "PTR_FMT", ino = %lld",
|
||||
__func__, dip, bp, in_f->ilf_ino);
|
||||
error = -EFSCORRUPTED;
|
||||
goto out_release;
|
||||
@ -329,7 +329,7 @@ xlog_recover_inode_commit_pass2(
|
||||
ldip = item->ri_buf[1].i_addr;
|
||||
if (XFS_IS_CORRUPT(mp, ldip->di_magic != XFS_DINODE_MAGIC)) {
|
||||
xfs_alert(mp,
|
||||
"%s: Bad inode log record, rec ptr "PTR_FMT", ino %Ld",
|
||||
"%s: Bad inode log record, rec ptr "PTR_FMT", ino %lld",
|
||||
__func__, item, in_f->ilf_ino);
|
||||
error = -EFSCORRUPTED;
|
||||
goto out_release;
|
||||
|
@ -558,6 +558,8 @@ xfs_vn_getattr(
|
||||
struct inode *inode = d_inode(path->dentry);
|
||||
struct xfs_inode *ip = XFS_I(inode);
|
||||
struct xfs_mount *mp = ip->i_mount;
|
||||
vfsuid_t vfsuid = i_uid_into_vfsuid(mnt_userns, inode);
|
||||
vfsgid_t vfsgid = i_gid_into_vfsgid(mnt_userns, inode);
|
||||
|
||||
trace_xfs_getattr(ip);
|
||||
|
||||
@ -568,8 +570,8 @@ xfs_vn_getattr(
|
||||
stat->dev = inode->i_sb->s_dev;
|
||||
stat->mode = inode->i_mode;
|
||||
stat->nlink = inode->i_nlink;
|
||||
stat->uid = i_uid_into_mnt(mnt_userns, inode);
|
||||
stat->gid = i_gid_into_mnt(mnt_userns, inode);
|
||||
stat->uid = vfsuid_into_kuid(vfsuid);
|
||||
stat->gid = vfsgid_into_kgid(vfsgid);
|
||||
stat->ino = ip->i_ino;
|
||||
stat->atime = inode->i_atime;
|
||||
stat->mtime = inode->i_mtime;
|
||||
|
@ -13,7 +13,6 @@ extern const struct file_operations xfs_dir_file_operations;
|
||||
|
||||
extern ssize_t xfs_vn_listxattr(struct dentry *, char *data, size_t size);
|
||||
|
||||
extern void xfs_setattr_time(struct xfs_inode *ip, struct iattr *iattr);
|
||||
int xfs_vn_setattr_size(struct user_namespace *mnt_userns,
|
||||
struct dentry *dentry, struct iattr *vap);
|
||||
|
||||
|
@ -66,6 +66,8 @@ xfs_bulkstat_one_int(
|
||||
struct xfs_bulkstat *buf = bc->buf;
|
||||
xfs_extnum_t nextents;
|
||||
int error = -EINVAL;
|
||||
vfsuid_t vfsuid;
|
||||
vfsgid_t vfsgid;
|
||||
|
||||
if (xfs_internal_inum(mp, ino))
|
||||
goto out_advance;
|
||||
@ -81,14 +83,16 @@ xfs_bulkstat_one_int(
|
||||
ASSERT(ip != NULL);
|
||||
ASSERT(ip->i_imap.im_blkno != 0);
|
||||
inode = VFS_I(ip);
|
||||
vfsuid = i_uid_into_vfsuid(mnt_userns, inode);
|
||||
vfsgid = i_gid_into_vfsgid(mnt_userns, inode);
|
||||
|
||||
/* xfs_iget returns the following without needing
|
||||
* further change.
|
||||
*/
|
||||
buf->bs_projectid = ip->i_projid;
|
||||
buf->bs_ino = ino;
|
||||
buf->bs_uid = from_kuid(sb_userns, i_uid_into_mnt(mnt_userns, inode));
|
||||
buf->bs_gid = from_kgid(sb_userns, i_gid_into_mnt(mnt_userns, inode));
|
||||
buf->bs_uid = from_kuid(sb_userns, vfsuid_into_kuid(vfsuid));
|
||||
buf->bs_gid = from_kgid(sb_userns, vfsgid_into_kgid(vfsgid));
|
||||
buf->bs_size = ip->i_disk_size;
|
||||
|
||||
buf->bs_nlink = inode->i_nlink;
|
||||
|
@ -226,12 +226,12 @@ xlog_ticket_reservation(
|
||||
if (head == &log->l_write_head) {
|
||||
ASSERT(tic->t_flags & XLOG_TIC_PERM_RESERV);
|
||||
return tic->t_unit_res;
|
||||
} else {
|
||||
if (tic->t_flags & XLOG_TIC_PERM_RESERV)
|
||||
return tic->t_unit_res * tic->t_cnt;
|
||||
else
|
||||
return tic->t_unit_res;
|
||||
}
|
||||
|
||||
if (tic->t_flags & XLOG_TIC_PERM_RESERV)
|
||||
return tic->t_unit_res * tic->t_cnt;
|
||||
|
||||
return tic->t_unit_res;
|
||||
}
|
||||
|
||||
STATIC bool
|
||||
|
@ -300,26 +300,28 @@ xfs_validate_new_dalign(
|
||||
"alignment check failed: sunit/swidth vs. blocksize(%d)",
|
||||
mp->m_sb.sb_blocksize);
|
||||
return -EINVAL;
|
||||
} else {
|
||||
/*
|
||||
* Convert the stripe unit and width to FSBs.
|
||||
*/
|
||||
mp->m_dalign = XFS_BB_TO_FSBT(mp, mp->m_dalign);
|
||||
if (mp->m_dalign && (mp->m_sb.sb_agblocks % mp->m_dalign)) {
|
||||
xfs_warn(mp,
|
||||
"alignment check failed: sunit/swidth vs. agsize(%d)",
|
||||
mp->m_sb.sb_agblocks);
|
||||
return -EINVAL;
|
||||
} else if (mp->m_dalign) {
|
||||
mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth);
|
||||
} else {
|
||||
xfs_warn(mp,
|
||||
"alignment check failed: sunit(%d) less than bsize(%d)",
|
||||
mp->m_dalign, mp->m_sb.sb_blocksize);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert the stripe unit and width to FSBs.
|
||||
*/
|
||||
mp->m_dalign = XFS_BB_TO_FSBT(mp, mp->m_dalign);
|
||||
if (mp->m_dalign && (mp->m_sb.sb_agblocks % mp->m_dalign)) {
|
||||
xfs_warn(mp,
|
||||
"alignment check failed: sunit/swidth vs. agsize(%d)",
|
||||
mp->m_sb.sb_agblocks);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!mp->m_dalign) {
|
||||
xfs_warn(mp,
|
||||
"alignment check failed: sunit(%d) less than bsize(%d)",
|
||||
mp->m_dalign, mp->m_sb.sb_blocksize);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth);
|
||||
|
||||
if (!xfs_has_dalign(mp)) {
|
||||
xfs_warn(mp,
|
||||
"cannot change alignment: superblock does not support data alignment");
|
||||
|
@ -23,17 +23,18 @@
|
||||
#include <linux/mm.h>
|
||||
#include <linux/dax.h>
|
||||
|
||||
struct failure_info {
|
||||
struct xfs_failure_info {
|
||||
xfs_agblock_t startblock;
|
||||
xfs_extlen_t blockcount;
|
||||
int mf_flags;
|
||||
bool want_shutdown;
|
||||
};
|
||||
|
||||
static pgoff_t
|
||||
xfs_failure_pgoff(
|
||||
struct xfs_mount *mp,
|
||||
const struct xfs_rmap_irec *rec,
|
||||
const struct failure_info *notify)
|
||||
const struct xfs_failure_info *notify)
|
||||
{
|
||||
loff_t pos = XFS_FSB_TO_B(mp, rec->rm_offset);
|
||||
|
||||
@ -47,7 +48,7 @@ static unsigned long
|
||||
xfs_failure_pgcnt(
|
||||
struct xfs_mount *mp,
|
||||
const struct xfs_rmap_irec *rec,
|
||||
const struct failure_info *notify)
|
||||
const struct xfs_failure_info *notify)
|
||||
{
|
||||
xfs_agblock_t end_rec;
|
||||
xfs_agblock_t end_notify;
|
||||
@ -71,13 +72,13 @@ xfs_dax_failure_fn(
|
||||
{
|
||||
struct xfs_mount *mp = cur->bc_mp;
|
||||
struct xfs_inode *ip;
|
||||
struct failure_info *notify = data;
|
||||
struct xfs_failure_info *notify = data;
|
||||
int error = 0;
|
||||
|
||||
if (XFS_RMAP_NON_INODE_OWNER(rec->rm_owner) ||
|
||||
(rec->rm_flags & (XFS_RMAP_ATTR_FORK | XFS_RMAP_BMBT_BLOCK))) {
|
||||
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_ONDISK);
|
||||
return -EFSCORRUPTED;
|
||||
notify->want_shutdown = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get files that incore, filter out others that are not in use. */
|
||||
@ -86,8 +87,10 @@ xfs_dax_failure_fn(
|
||||
/* Continue the rmap query if the inode isn't incore */
|
||||
if (error == -ENODATA)
|
||||
return 0;
|
||||
if (error)
|
||||
return error;
|
||||
if (error) {
|
||||
notify->want_shutdown = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
error = mf_dax_kill_procs(VFS_I(ip)->i_mapping,
|
||||
xfs_failure_pgoff(mp, rec, notify),
|
||||
@ -104,6 +107,7 @@ xfs_dax_notify_ddev_failure(
|
||||
xfs_daddr_t bblen,
|
||||
int mf_flags)
|
||||
{
|
||||
struct xfs_failure_info notify = { .mf_flags = mf_flags };
|
||||
struct xfs_trans *tp = NULL;
|
||||
struct xfs_btree_cur *cur = NULL;
|
||||
struct xfs_buf *agf_bp = NULL;
|
||||
@ -120,7 +124,6 @@ xfs_dax_notify_ddev_failure(
|
||||
for (; agno <= end_agno; agno++) {
|
||||
struct xfs_rmap_irec ri_low = { };
|
||||
struct xfs_rmap_irec ri_high;
|
||||
struct failure_info notify;
|
||||
struct xfs_agf *agf;
|
||||
xfs_agblock_t agend;
|
||||
struct xfs_perag *pag;
|
||||
@ -161,6 +164,11 @@ xfs_dax_notify_ddev_failure(
|
||||
}
|
||||
|
||||
xfs_trans_cancel(tp);
|
||||
if (error || notify.want_shutdown) {
|
||||
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_ONDISK);
|
||||
if (!error)
|
||||
error = -EFSCORRUPTED;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,9 @@ xfs_reflink_trim_around_shared(
|
||||
if (fbno == NULLAGBLOCK) {
|
||||
/* No shared blocks at all. */
|
||||
return 0;
|
||||
} else if (fbno == agbno) {
|
||||
}
|
||||
|
||||
if (fbno == agbno) {
|
||||
/*
|
||||
* The start of this extent is shared. Truncate the
|
||||
* mapping at the end of the shared region so that a
|
||||
@ -210,16 +212,16 @@ xfs_reflink_trim_around_shared(
|
||||
irec->br_blockcount = flen;
|
||||
*shared = true;
|
||||
return 0;
|
||||
} else {
|
||||
/*
|
||||
* There's a shared extent midway through this extent.
|
||||
* Truncate the mapping at the start of the shared
|
||||
* extent so that a subsequent iteration starts at the
|
||||
* start of the shared region.
|
||||
*/
|
||||
irec->br_blockcount = fbno - agbno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* There's a shared extent midway through this extent.
|
||||
* Truncate the mapping at the start of the shared
|
||||
* extent so that a subsequent iteration starts at the
|
||||
* start of the shared region.
|
||||
*/
|
||||
irec->br_blockcount = fbno - agbno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -74,7 +74,7 @@ int xfs_stats_format(struct xfsstats __percpu *stats, char *buf)
|
||||
defer_relog += per_cpu_ptr(stats, i)->s.defer_relog;
|
||||
}
|
||||
|
||||
len += scnprintf(buf + len, PATH_MAX-len, "xpc %Lu %Lu %Lu\n",
|
||||
len += scnprintf(buf + len, PATH_MAX-len, "xpc %llu %llu %llu\n",
|
||||
xs_xstrat_bytes, xs_write_bytes, xs_read_bytes);
|
||||
len += scnprintf(buf + len, PATH_MAX-len, "defer_relog %llu\n",
|
||||
defer_relog);
|
||||
@ -125,7 +125,7 @@ static int xqmstat_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
int j;
|
||||
|
||||
seq_printf(m, "qm");
|
||||
seq_puts(m, "qm");
|
||||
for (j = XFSSTAT_START_XQMSTAT; j < XFSSTAT_END_XQMSTAT; j++)
|
||||
seq_printf(m, " %u", counter_val(xfsstats.xs_stats, j));
|
||||
seq_putc(m, '\n');
|
||||
|
@ -1170,7 +1170,7 @@ DECLARE_EVENT_CLASS(xfs_dqtrx_class,
|
||||
__entry->ino_res_used = qtrx->qt_ino_res_used;
|
||||
__entry->icount_delta = qtrx->qt_icount_delta;
|
||||
),
|
||||
TP_printk("dev %d:%d dquot id 0x%x type %s flags %s"
|
||||
TP_printk("dev %d:%d dquot id 0x%x type %s flags %s "
|
||||
"blk_res %llu bcount_delta %lld delbcnt_delta %lld "
|
||||
"rtblk_res %llu rtblk_res_used %llu rtbcount_delta %lld delrtb_delta %lld "
|
||||
"ino_res %llu ino_res_used %llu icount_delta %lld",
|
||||
@ -1602,7 +1602,7 @@ TRACE_EVENT(xfs_bunmap,
|
||||
__entry->caller_ip = caller_ip;
|
||||
__entry->flags = flags;
|
||||
),
|
||||
TP_printk("dev %d:%d ino 0x%llx disize 0x%llx fileoff 0x%llx fsbcount 0x%llx"
|
||||
TP_printk("dev %d:%d ino 0x%llx disize 0x%llx fileoff 0x%llx fsbcount 0x%llx "
|
||||
"flags %s caller %pS",
|
||||
MAJOR(__entry->dev), MINOR(__entry->dev),
|
||||
__entry->ino,
|
||||
|
Loading…
Reference in New Issue
Block a user