Skip to content

Commit 60bb815

Browse files
committed
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
2 parents 5d170fe + e033f40 commit 60bb815

21 files changed

+116
-98
lines changed

fs/xfs/libxfs/xfs_bmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ xfs_check_block(
294294
else
295295
thispa = XFS_BMBT_PTR_ADDR(mp, block, j, dmxr);
296296
if (*thispa == *pp) {
297-
xfs_warn(mp, "%s: thispa(%d) == pp(%d) %Ld",
297+
xfs_warn(mp, "%s: thispa(%d) == pp(%d) %lld",
298298
__func__, j, i,
299299
(unsigned long long)be64_to_cpu(*thispa));
300300
xfs_err(mp, "%s: ptrs are equal in node\n",

fs/xfs/libxfs/xfs_da_btree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2192,8 +2192,8 @@ xfs_da_grow_inode_int(
21922192
*/
21932193
mapp = kmem_alloc(sizeof(*mapp) * count, 0);
21942194
for (b = *bno, mapi = 0; b < *bno + count; ) {
2195-
nmap = min(XFS_BMAP_MAX_NMAP, count);
21962195
c = (int)(*bno + count - b);
2196+
nmap = min(XFS_BMAP_MAX_NMAP, c);
21972197
error = xfs_bmapi_write(tp, dp, b, c,
21982198
xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA,
21992199
args->total, &mapp[mapi], &nmap);

fs/xfs/libxfs/xfs_dir2.c

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ xfs_dir_createname(
261261
{
262262
struct xfs_da_args *args;
263263
int rval;
264-
int v; /* type-checking value */
264+
bool v;
265265

266266
ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
267267

@@ -357,7 +357,7 @@ xfs_dir_lookup(
357357
{
358358
struct xfs_da_args *args;
359359
int rval;
360-
int v; /* type-checking value */
360+
bool v;
361361
int lock_mode;
362362

363363
ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
@@ -435,7 +435,7 @@ xfs_dir_removename(
435435
{
436436
struct xfs_da_args *args;
437437
int rval;
438-
int v; /* type-checking value */
438+
bool v;
439439

440440
ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
441441
XFS_STATS_INC(dp->i_mount, xs_dir_remove);
@@ -493,7 +493,7 @@ xfs_dir_replace(
493493
{
494494
struct xfs_da_args *args;
495495
int rval;
496-
int v; /* type-checking value */
496+
bool v;
497497

498498
ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
499499

@@ -610,19 +610,23 @@ xfs_dir2_grow_inode(
610610
int
611611
xfs_dir2_isblock(
612612
struct xfs_da_args *args,
613-
int *vp) /* out: 1 is block, 0 is not block */
613+
bool *isblock)
614614
{
615-
xfs_fileoff_t last; /* last file offset */
616-
int rval;
615+
struct xfs_mount *mp = args->dp->i_mount;
616+
xfs_fileoff_t eof;
617+
int error;
617618

618-
if ((rval = xfs_bmap_last_offset(args->dp, &last, XFS_DATA_FORK)))
619-
return rval;
620-
rval = XFS_FSB_TO_B(args->dp->i_mount, last) == args->geo->blksize;
621-
if (XFS_IS_CORRUPT(args->dp->i_mount,
622-
rval != 0 &&
623-
args->dp->i_disk_size != args->geo->blksize))
619+
error = xfs_bmap_last_offset(args->dp, &eof, XFS_DATA_FORK);
620+
if (error)
621+
return error;
622+
623+
*isblock = false;
624+
if (XFS_FSB_TO_B(mp, eof) != args->geo->blksize)
625+
return 0;
626+
627+
*isblock = true;
628+
if (XFS_IS_CORRUPT(mp, args->dp->i_disk_size != args->geo->blksize))
624629
return -EFSCORRUPTED;
625-
*vp = rval;
626630
return 0;
627631
}
628632

@@ -632,14 +636,20 @@ xfs_dir2_isblock(
632636
int
633637
xfs_dir2_isleaf(
634638
struct xfs_da_args *args,
635-
int *vp) /* out: 1 is block, 0 is not block */
639+
bool *isleaf)
636640
{
637-
xfs_fileoff_t last; /* last file offset */
638-
int rval;
641+
xfs_fileoff_t eof;
642+
int error;
639643

640-
if ((rval = xfs_bmap_last_offset(args->dp, &last, XFS_DATA_FORK)))
641-
return rval;
642-
*vp = last == args->geo->leafblk + args->geo->fsbcount;
644+
error = xfs_bmap_last_offset(args->dp, &eof, XFS_DATA_FORK);
645+
if (error)
646+
return error;
647+
648+
*isleaf = false;
649+
if (eof != args->geo->leafblk + args->geo->fsbcount)
650+
return 0;
651+
652+
*isleaf = true;
643653
return 0;
644654
}
645655

fs/xfs/libxfs/xfs_dir2.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);
6161
/*
6262
* Interface routines used by userspace utilities
6363
*/
64-
extern int xfs_dir2_isblock(struct xfs_da_args *args, int *r);
65-
extern int xfs_dir2_isleaf(struct xfs_da_args *args, int *r);
64+
extern int xfs_dir2_isblock(struct xfs_da_args *args, bool *isblock);
65+
extern int xfs_dir2_isleaf(struct xfs_da_args *args, bool *isleaf);
6666
extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
6767
struct xfs_buf *bp);
6868

fs/xfs/libxfs/xfs_dir2_sf.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,6 @@ xfs_dir2_sf_lookup(
865865
struct xfs_inode *dp = args->dp;
866866
struct xfs_mount *mp = dp->i_mount;
867867
int i; /* entry index */
868-
int error;
869868
xfs_dir2_sf_entry_t *sfep; /* shortform directory entry */
870869
xfs_dir2_sf_hdr_t *sfp; /* shortform structure */
871870
enum xfs_dacmp cmp; /* comparison result */
@@ -929,8 +928,7 @@ xfs_dir2_sf_lookup(
929928
if (!ci_sfep)
930929
return -ENOENT;
931930
/* otherwise process the CI match as required by the caller */
932-
error = xfs_dir_cilookup_result(args, ci_sfep->name, ci_sfep->namelen);
933-
return error;
931+
return xfs_dir_cilookup_result(args, ci_sfep->name, ci_sfep->namelen);
934932
}
935933

936934
/*

fs/xfs/libxfs/xfs_inode_fork.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ xfs_iformat_local(
7878
*/
7979
if (unlikely(size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) {
8080
xfs_warn(ip->i_mount,
81-
"corrupt inode %Lu (bad size %d for local fork, size = %zd).",
81+
"corrupt inode %llu (bad size %d for local fork, size = %zd).",
8282
(unsigned long long) ip->i_ino, size,
8383
XFS_DFORK_SIZE(dip, ip->i_mount, whichfork));
8484
xfs_inode_verifier_error(ip, -EFSCORRUPTED,
@@ -192,7 +192,7 @@ xfs_iformat_btree(
192192
XFS_DFORK_SIZE(dip, mp, whichfork) ||
193193
ifp->if_nextents > ip->i_nblocks) ||
194194
level == 0 || level > XFS_BM_MAXLEVELS(mp, whichfork)) {
195-
xfs_warn(mp, "corrupt inode %Lu (btree).",
195+
xfs_warn(mp, "corrupt inode %llu (btree).",
196196
(unsigned long long) ip->i_ino);
197197
xfs_inode_verifier_error(ip, -EFSCORRUPTED,
198198
"xfs_iformat_btree", dfp, size,

fs/xfs/scrub/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ xchk_directory_blocks(
676676
xfs_dablk_t dabno;
677677
xfs_dir2_db_t last_data_db = 0;
678678
bool found;
679-
int is_block = 0;
679+
bool is_block = false;
680680
int error;
681681

682682
/* Ignore local format directories. */

fs/xfs/xfs_attr_item.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ xfs_attri_log_nameval_alloc(
8686
*/
8787
nv = xlog_kvmalloc(sizeof(struct xfs_attri_log_nameval) +
8888
name_len + value_len);
89-
if (!nv)
90-
return nv;
9189

9290
nv->name.i_addr = nv + 1;
9391
nv->name.i_len = name_len;
@@ -441,8 +439,6 @@ xfs_attr_create_intent(
441439
attr->xattri_nameval = xfs_attri_log_nameval_alloc(args->name,
442440
args->namelen, args->value, args->valuelen);
443441
}
444-
if (!attr->xattri_nameval)
445-
return ERR_PTR(-ENOMEM);
446442

447443
attrip = xfs_attri_init(mp, attr->xattri_nameval);
448444
xfs_trans_add_item(tp, &attrip->attri_item);
@@ -762,8 +758,6 @@ xlog_recover_attri_commit_pass2(
762758
nv = xfs_attri_log_nameval_alloc(attr_name,
763759
attri_formatp->alfi_name_len, attr_value,
764760
attri_formatp->alfi_value_len);
765-
if (!nv)
766-
return -ENOMEM;
767761

768762
attrip = xfs_attri_init(mp, nv);
769763
error = xfs_attri_copy_format(&item->ri_buf[0], &attrip->attri_format);

fs/xfs/xfs_dir2_readdir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ xfs_readdir(
512512
{
513513
struct xfs_da_args args = { NULL };
514514
unsigned int lock_mode;
515-
int isblock;
515+
bool isblock;
516516
int error;
517517

518518
trace_xfs_readdir(dp);

fs/xfs/xfs_inode.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -835,9 +835,8 @@ xfs_init_new_inode(
835835
* ID or one of the supplementary group IDs, the S_ISGID bit is cleared
836836
* (and only if the irix_sgid_inherit compatibility variable is set).
837837
*/
838-
if (irix_sgid_inherit &&
839-
(inode->i_mode & S_ISGID) &&
840-
!in_group_p(i_gid_into_mnt(mnt_userns, inode)))
838+
if (irix_sgid_inherit && (inode->i_mode & S_ISGID) &&
839+
!vfsgid_in_group_p(i_gid_into_vfsgid(mnt_userns, inode)))
841840
inode->i_mode &= ~S_ISGID;
842841

843842
ip->i_disk_size = 0;
@@ -3119,7 +3118,7 @@ xfs_iflush(
31193118
if (XFS_TEST_ERROR(dip->di_magic != cpu_to_be16(XFS_DINODE_MAGIC),
31203119
mp, XFS_ERRTAG_IFLUSH_1)) {
31213120
xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
3122-
"%s: Bad inode %Lu magic number 0x%x, ptr "PTR_FMT,
3121+
"%s: Bad inode %llu magic number 0x%x, ptr "PTR_FMT,
31233122
__func__, ip->i_ino, be16_to_cpu(dip->di_magic), dip);
31243123
goto flush_out;
31253124
}
@@ -3129,7 +3128,7 @@ xfs_iflush(
31293128
ip->i_df.if_format != XFS_DINODE_FMT_BTREE,
31303129
mp, XFS_ERRTAG_IFLUSH_3)) {
31313130
xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
3132-
"%s: Bad regular inode %Lu, ptr "PTR_FMT,
3131+
"%s: Bad regular inode %llu, ptr "PTR_FMT,
31333132
__func__, ip->i_ino, ip);
31343133
goto flush_out;
31353134
}
@@ -3140,7 +3139,7 @@ xfs_iflush(
31403139
ip->i_df.if_format != XFS_DINODE_FMT_LOCAL,
31413140
mp, XFS_ERRTAG_IFLUSH_4)) {
31423141
xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
3143-
"%s: Bad directory inode %Lu, ptr "PTR_FMT,
3142+
"%s: Bad directory inode %llu, ptr "PTR_FMT,
31443143
__func__, ip->i_ino, ip);
31453144
goto flush_out;
31463145
}
@@ -3158,7 +3157,7 @@ xfs_iflush(
31583157
if (XFS_TEST_ERROR(ip->i_forkoff > mp->m_sb.sb_inodesize,
31593158
mp, XFS_ERRTAG_IFLUSH_6)) {
31603159
xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
3161-
"%s: bad inode %Lu, forkoff 0x%x, ptr "PTR_FMT,
3160+
"%s: bad inode %llu, forkoff 0x%x, ptr "PTR_FMT,
31623161
__func__, ip->i_ino, ip->i_forkoff, ip);
31633162
goto flush_out;
31643163
}

0 commit comments

Comments
 (0)