Skip to content

Commit

Permalink
fs/fs-writeback.c: resolve build errors
Browse files Browse the repository at this point in the history
resolve errors from fs/fs-writeback.c
and
Revert "overflow.h: Add allocation size calculation helpers"

This reverts commit cf01eb6.
  • Loading branch information
xyz-sundram committed Jan 23, 2024
1 parent 02fc6fd commit f3b37f8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 85 deletions.
4 changes: 2 additions & 2 deletions drivers/scsi/ufs/ufshcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -6849,7 +6849,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
/* command completed already */
dev_err(hba->dev, "%s: cmd at tag %d successfully cleared from DB.\n",
__func__, tag);
goto cleanup;
goto clean;
} else {
dev_err(hba->dev,
"%s: no response from device. tag = %d, err %d\n",
Expand Down Expand Up @@ -6895,7 +6895,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
goto out;
}

cleanup:
clean:
scsi_dma_unmap(cmd);

spin_lock_irqsave(host->host_lock, flags);
Expand Down
15 changes: 5 additions & 10 deletions fs/fs-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -1113,13 +1113,6 @@ static void redirty_tail(struct inode *inode, struct bdi_writeback *wb)
spin_unlock(&inode->i_lock);
}

static void redirty_tail(struct inode *inode, struct bdi_writeback *wb)
{
spin_lock(&inode->i_lock);
redirty_tail_locked(inode, wb);
spin_unlock(&inode->i_lock);
}

/*
* requeue inode for re-scanning after bdi->b_io list is exhausted.
*/
Expand Down Expand Up @@ -1177,6 +1170,8 @@ static int move_expired_inodes(struct list_head *delaying_queue,
list_move(&inode->i_io_list, &tmp);
moved++;
spin_lock(&inode->i_lock);
if (flags & EXPIRE_DIRTY_ATIME)
inode->i_state |= I_DIRTY_TIME_EXPIRED;
inode->i_state |= I_SYNC_QUEUED;
spin_unlock(&inode->i_lock);
if (sb_is_blkdev_sb(inode->i_sb))
Expand Down Expand Up @@ -1224,11 +1219,11 @@ static void queue_io(struct bdi_writeback *wb, struct wb_writeback_work *work,

assert_spin_locked(&wb->list_lock);
list_splice_init(&wb->b_more_io, &wb->b_io);
moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, dirtied_before);
moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, 0, dirtied_before);
if (!work->for_sync)
time_expire_jif = jiffies - dirtytime_expire_interval * HZ;
moved += move_expired_inodes(&wb->b_dirty_time, &wb->b_io,
time_expire_jif);
EXPIRE_DIRTY_ATIME, time_expire_jif);
if (moved)
wb_io_lists_populated(wb);
trace_writeback_queue_io(wb, work, dirtied_before, moved);
Expand Down Expand Up @@ -2542,4 +2537,4 @@ int sync_inode_metadata(struct inode *inode, int wait)

return sync_inode(inode, &wbc);
}
EXPORT_SYMBOL(sync_inode_metadata);
EXPORT_SYMBOL(sync_inode_metadata);
73 changes: 0 additions & 73 deletions include/linux/overflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,77 +306,4 @@ static inline __must_check size_t __ab_c_size(size_t n, size_t size, size_t c)
(*_d >> _to_shift) != _a); \
})

/**
* array_size() - Calculate size of 2-dimensional array.
*
* @a: dimension one
* @b: dimension two
*
* Calculates size of 2-dimensional array: @a * @b.
*
* Returns: number of bytes needed to represent the array or SIZE_MAX on
* overflow.
*/
static inline __must_check size_t array_size(size_t a, size_t b)
{
size_t bytes;

if (check_mul_overflow(a, b, &bytes))
return SIZE_MAX;

return bytes;
}

/**
* array3_size() - Calculate size of 3-dimensional array.
*
* @a: dimension one
* @b: dimension two
* @c: dimension three
*
* Calculates size of 3-dimensional array: @a * @b * @c.
*
* Returns: number of bytes needed to represent the array or SIZE_MAX on
* overflow.
*/
static inline __must_check size_t array3_size(size_t a, size_t b, size_t c)
{
size_t bytes;

if (check_mul_overflow(a, b, &bytes))
return SIZE_MAX;
if (check_mul_overflow(bytes, c, &bytes))
return SIZE_MAX;

return bytes;
}

static inline __must_check size_t __ab_c_size(size_t n, size_t size, size_t c)
{
size_t bytes;

if (check_mul_overflow(n, size, &bytes))
return SIZE_MAX;
if (check_add_overflow(bytes, c, &bytes))
return SIZE_MAX;

return bytes;
}

/**
* struct_size() - Calculate size of structure with trailing array.
* @p: Pointer to the structure.
* @member: Name of the array member.
* @n: Number of elements in the array.
*
* Calculates size of memory needed for structure @p followed by an
* array of @n @member elements.
*
* Return: number of bytes needed or SIZE_MAX on overflow.
*/
#define struct_size(p, member, n) \
__ab_c_size(n, \
sizeof(*(p)->member) + __must_be_array((p)->member),\
sizeof(*(p)))

#endif /* __LINUX_OVERFLOW_H */

0 comments on commit f3b37f8

Please sign in to comment.