xfs: change some error-less functions to void types

There are several functions which have no opportunity to return
an error, and don't contain any ASSERTs which could be argued
to be better constructed as error cases.  So, make them voids
to simplify the callers.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
Eric Sandeen 2019-05-01 20:26:30 -07:00 committed by Darrick J. Wong
parent 75efa57d0b
commit 910832697c
11 changed files with 26 additions and 58 deletions

View File

@ -110,7 +110,7 @@ xfs_dqblk_verify(
/* /*
* Do some primitive error checking on ondisk dquot data structures. * Do some primitive error checking on ondisk dquot data structures.
*/ */
int void
xfs_dqblk_repair( xfs_dqblk_repair(
struct xfs_mount *mp, struct xfs_mount *mp,
struct xfs_dqblk *dqb, struct xfs_dqblk *dqb,
@ -133,8 +133,6 @@ xfs_dqblk_repair(
xfs_update_cksum((char *)dqb, sizeof(struct xfs_dqblk), xfs_update_cksum((char *)dqb, sizeof(struct xfs_dqblk),
XFS_DQUOT_CRC_OFF); XFS_DQUOT_CRC_OFF);
} }
return 0;
} }
STATIC bool STATIC bool

View File

@ -142,7 +142,7 @@ extern xfs_failaddr_t xfs_dquot_verify(struct xfs_mount *mp,
extern xfs_failaddr_t xfs_dqblk_verify(struct xfs_mount *mp, extern xfs_failaddr_t xfs_dqblk_verify(struct xfs_mount *mp,
struct xfs_dqblk *dqb, xfs_dqid_t id, uint type); struct xfs_dqblk *dqb, xfs_dqid_t id, uint type);
extern int xfs_calc_dquots_per_chunk(unsigned int nbblks); extern int xfs_calc_dquots_per_chunk(unsigned int nbblks);
extern int xfs_dqblk_repair(struct xfs_mount *mp, struct xfs_dqblk *dqb, extern void xfs_dqblk_repair(struct xfs_mount *mp, struct xfs_dqblk *dqb,
xfs_dqid_t id, uint type); xfs_dqid_t id, uint type);
#endif /* __XFS_QUOTA_H__ */ #endif /* __XFS_QUOTA_H__ */

View File

@ -1085,7 +1085,7 @@ out:
return error; return error;
} }
int void
xfs_fs_geometry( xfs_fs_geometry(
struct xfs_sb *sbp, struct xfs_sb *sbp,
struct xfs_fsop_geom *geo, struct xfs_fsop_geom *geo,
@ -1109,13 +1109,13 @@ xfs_fs_geometry(
memcpy(geo->uuid, &sbp->sb_uuid, sizeof(sbp->sb_uuid)); memcpy(geo->uuid, &sbp->sb_uuid, sizeof(sbp->sb_uuid));
if (struct_version < 2) if (struct_version < 2)
return 0; return;
geo->sunit = sbp->sb_unit; geo->sunit = sbp->sb_unit;
geo->swidth = sbp->sb_width; geo->swidth = sbp->sb_width;
if (struct_version < 3) if (struct_version < 3)
return 0; return;
geo->version = XFS_FSOP_GEOM_VERSION; geo->version = XFS_FSOP_GEOM_VERSION;
geo->flags = XFS_FSOP_GEOM_FLAGS_NLINK | geo->flags = XFS_FSOP_GEOM_FLAGS_NLINK |
@ -1159,7 +1159,7 @@ xfs_fs_geometry(
geo->dirblocksize = xfs_dir2_dirblock_bytes(sbp); geo->dirblocksize = xfs_dir2_dirblock_bytes(sbp);
if (struct_version < 4) if (struct_version < 4)
return 0; return;
if (xfs_sb_version_haslogv2(sbp)) if (xfs_sb_version_haslogv2(sbp))
geo->flags |= XFS_FSOP_GEOM_FLAGS_LOGV2; geo->flags |= XFS_FSOP_GEOM_FLAGS_LOGV2;
@ -1167,11 +1167,9 @@ xfs_fs_geometry(
geo->logsunit = sbp->sb_logsunit; geo->logsunit = sbp->sb_logsunit;
if (struct_version < 5) if (struct_version < 5)
return 0; return;
geo->version = XFS_FSOP_GEOM_VERSION_V5; geo->version = XFS_FSOP_GEOM_VERSION_V5;
return 0;
} }
/* Read a secondary superblock. */ /* Read a secondary superblock. */

View File

@ -33,7 +33,7 @@ extern void xfs_sb_quota_from_disk(struct xfs_sb *sbp);
extern int xfs_update_secondary_sbs(struct xfs_mount *mp); extern int xfs_update_secondary_sbs(struct xfs_mount *mp);
#define XFS_FS_GEOM_MAX_STRUCT_VER (4) #define XFS_FS_GEOM_MAX_STRUCT_VER (4)
extern int xfs_fs_geometry(struct xfs_sb *sbp, struct xfs_fsop_geom *geo, extern void xfs_fs_geometry(struct xfs_sb *sbp, struct xfs_fsop_geom *geo,
int struct_version); int struct_version);
extern int xfs_sb_read_secondary(struct xfs_mount *mp, extern int xfs_sb_read_secondary(struct xfs_mount *mp,
struct xfs_trans *tp, xfs_agnumber_t agno, struct xfs_trans *tp, xfs_agnumber_t agno,

View File

@ -289,7 +289,7 @@ xfs_growfs_log(
* exported through ioctl XFS_IOC_FSCOUNTS * exported through ioctl XFS_IOC_FSCOUNTS
*/ */
int void
xfs_fs_counts( xfs_fs_counts(
xfs_mount_t *mp, xfs_mount_t *mp,
xfs_fsop_counts_t *cnt) xfs_fsop_counts_t *cnt)
@ -302,7 +302,6 @@ xfs_fs_counts(
spin_lock(&mp->m_sb_lock); spin_lock(&mp->m_sb_lock);
cnt->freertx = mp->m_sb.sb_frextents; cnt->freertx = mp->m_sb.sb_frextents;
spin_unlock(&mp->m_sb_lock); spin_unlock(&mp->m_sb_lock);
return 0;
} }
/* /*

View File

@ -8,7 +8,7 @@
extern int xfs_growfs_data(xfs_mount_t *mp, xfs_growfs_data_t *in); extern int xfs_growfs_data(xfs_mount_t *mp, xfs_growfs_data_t *in);
extern int xfs_growfs_log(xfs_mount_t *mp, xfs_growfs_log_t *in); extern int xfs_growfs_log(xfs_mount_t *mp, xfs_growfs_log_t *in);
extern int xfs_fs_counts(xfs_mount_t *mp, xfs_fsop_counts_t *cnt); extern void xfs_fs_counts(xfs_mount_t *mp, xfs_fsop_counts_t *cnt);
extern int xfs_reserve_blocks(xfs_mount_t *mp, uint64_t *inval, extern int xfs_reserve_blocks(xfs_mount_t *mp, uint64_t *inval,
xfs_fsop_resblks_t *outval); xfs_fsop_resblks_t *outval);
extern int xfs_fs_goingdown(xfs_mount_t *mp, uint32_t inflags); extern int xfs_fs_goingdown(xfs_mount_t *mp, uint32_t inflags);

View File

@ -1116,7 +1116,7 @@ xfs_droplink(
/* /*
* Increment the link count on an inode & log the change. * Increment the link count on an inode & log the change.
*/ */
static int static void
xfs_bumplink( xfs_bumplink(
xfs_trans_t *tp, xfs_trans_t *tp,
xfs_inode_t *ip) xfs_inode_t *ip)
@ -1126,7 +1126,6 @@ xfs_bumplink(
ASSERT(ip->i_d.di_version > 1); ASSERT(ip->i_d.di_version > 1);
inc_nlink(VFS_I(ip)); inc_nlink(VFS_I(ip));
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
return 0;
} }
int int
@ -1235,9 +1234,7 @@ xfs_create(
if (error) if (error)
goto out_trans_cancel; goto out_trans_cancel;
error = xfs_bumplink(tp, dp); xfs_bumplink(tp, dp);
if (error)
goto out_trans_cancel;
} }
/* /*
@ -1454,9 +1451,7 @@ xfs_link(
xfs_trans_ichgtime(tp, tdp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); xfs_trans_ichgtime(tp, tdp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
xfs_trans_log_inode(tp, tdp, XFS_ILOG_CORE); xfs_trans_log_inode(tp, tdp, XFS_ILOG_CORE);
error = xfs_bumplink(tp, sip); xfs_bumplink(tp, sip);
if (error)
goto error_return;
/* /*
* If this is a synchronous mount, make sure that the * If this is a synchronous mount, make sure that the
@ -3097,9 +3092,7 @@ xfs_cross_rename(
error = xfs_droplink(tp, dp2); error = xfs_droplink(tp, dp2);
if (error) if (error)
goto out_trans_abort; goto out_trans_abort;
error = xfs_bumplink(tp, dp1); xfs_bumplink(tp, dp1);
if (error)
goto out_trans_abort;
} }
/* /*
@ -3123,9 +3116,7 @@ xfs_cross_rename(
error = xfs_droplink(tp, dp1); error = xfs_droplink(tp, dp1);
if (error) if (error)
goto out_trans_abort; goto out_trans_abort;
error = xfs_bumplink(tp, dp2); xfs_bumplink(tp, dp2);
if (error)
goto out_trans_abort;
} }
/* /*
@ -3322,9 +3313,7 @@ xfs_rename(
XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
if (new_parent && src_is_directory) { if (new_parent && src_is_directory) {
error = xfs_bumplink(tp, target_dp); xfs_bumplink(tp, target_dp);
if (error)
goto out_trans_cancel;
} }
} else { /* target_ip != NULL */ } else { /* target_ip != NULL */
/* /*
@ -3443,9 +3432,7 @@ xfs_rename(
*/ */
if (wip) { if (wip) {
ASSERT(VFS_I(wip)->i_nlink == 0); ASSERT(VFS_I(wip)->i_nlink == 0);
error = xfs_bumplink(tp, wip); xfs_bumplink(tp, wip);
if (error)
goto out_trans_cancel;
error = xfs_iunlink_remove(tp, wip); error = xfs_iunlink_remove(tp, wip);
if (error) if (error)
goto out_trans_cancel; goto out_trans_cancel;

View File

@ -788,11 +788,8 @@ xfs_ioc_fsgeometry(
{ {
struct xfs_fsop_geom fsgeo; struct xfs_fsop_geom fsgeo;
size_t len; size_t len;
int error;
error = xfs_fs_geometry(&mp->m_sb, &fsgeo, struct_version); xfs_fs_geometry(&mp->m_sb, &fsgeo, struct_version);
if (error)
return error;
if (struct_version <= 3) if (struct_version <= 3)
len = sizeof(struct xfs_fsop_geom_v1); len = sizeof(struct xfs_fsop_geom_v1);
@ -2046,9 +2043,7 @@ xfs_file_ioctl(
case XFS_IOC_FSCOUNTS: { case XFS_IOC_FSCOUNTS: {
xfs_fsop_counts_t out; xfs_fsop_counts_t out;
error = xfs_fs_counts(mp, &out); xfs_fs_counts(mp, &out);
if (error)
return error;
if (copy_to_user(arg, &out, sizeof(out))) if (copy_to_user(arg, &out, sizeof(out)))
return -EFAULT; return -EFAULT;

View File

@ -53,11 +53,8 @@ xfs_compat_ioc_fsgeometry_v1(
compat_xfs_fsop_geom_v1_t __user *arg32) compat_xfs_fsop_geom_v1_t __user *arg32)
{ {
struct xfs_fsop_geom fsgeo; struct xfs_fsop_geom fsgeo;
int error;
error = xfs_fs_geometry(&mp->m_sb, &fsgeo, 3); xfs_fs_geometry(&mp->m_sb, &fsgeo, 3);
if (error)
return error;
/* The 32-bit variant simply has some padding at the end */ /* The 32-bit variant simply has some padding at the end */
if (copy_to_user(arg32, &fsgeo, sizeof(struct compat_xfs_fsop_geom_v1))) if (copy_to_user(arg32, &fsgeo, sizeof(struct compat_xfs_fsop_geom_v1)))
return -EFAULT; return -EFAULT;

View File

@ -5167,7 +5167,7 @@ xlog_recover_process_iunlinks(
} }
} }
STATIC int STATIC void
xlog_unpack_data( xlog_unpack_data(
struct xlog_rec_header *rhead, struct xlog_rec_header *rhead,
char *dp, char *dp,
@ -5190,8 +5190,6 @@ xlog_unpack_data(
dp += BBSIZE; dp += BBSIZE;
} }
} }
return 0;
} }
/* /*
@ -5206,11 +5204,9 @@ xlog_recover_process(
int pass, int pass,
struct list_head *buffer_list) struct list_head *buffer_list)
{ {
int error;
__le32 old_crc = rhead->h_crc; __le32 old_crc = rhead->h_crc;
__le32 crc; __le32 crc;
crc = xlog_cksum(log, rhead, dp, be32_to_cpu(rhead->h_len)); crc = xlog_cksum(log, rhead, dp, be32_to_cpu(rhead->h_len));
/* /*
@ -5249,9 +5245,7 @@ xlog_recover_process(
return -EFSCORRUPTED; return -EFSCORRUPTED;
} }
error = xlog_unpack_data(rhead, dp, log); xlog_unpack_data(rhead, dp, log);
if (error)
return error;
return xlog_recover_process_data(log, rhash, rhead, dp, pass, return xlog_recover_process_data(log, rhash, rhead, dp, pass,
buffer_list); buffer_list);

View File

@ -444,7 +444,7 @@ struct proc_xfs_info {
char *str; char *str;
}; };
STATIC int STATIC void
xfs_showargs( xfs_showargs(
struct xfs_mount *mp, struct xfs_mount *mp,
struct seq_file *m) struct seq_file *m)
@ -523,9 +523,8 @@ xfs_showargs(
if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT)) if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT))
seq_puts(m, ",noquota"); seq_puts(m, ",noquota");
return 0;
} }
static uint64_t static uint64_t
xfs_max_file_offset( xfs_max_file_offset(
unsigned int blockshift) unsigned int blockshift)
@ -1445,7 +1444,8 @@ xfs_fs_show_options(
struct seq_file *m, struct seq_file *m,
struct dentry *root) struct dentry *root)
{ {
return xfs_showargs(XFS_M(root->d_sb), m); xfs_showargs(XFS_M(root->d_sb), m);
return 0;
} }
/* /*