mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
xfs: buftarg cleanups [v29.3 11/18]
Clean up the buffer target code in preparation for adding the ability to target tmpfs files. That will enable the creation of in memory btrees. This has been running on the djcloud for months with no problems. Enjoy! Signed-off-by: Darrick J. Wong <djwong@kernel.org> -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQ2qTKExjcn+O1o2YRKO3ySh0YRpgUCZdlBYgAKCRBKO3ySh0YR pi3lAQCo1U4Qp5ftsgR2FdjpxKofWJr7qqpXFMvDZhQSCF1yTAEAiRz018fUVTtt Hb9xUmu0XrHErtJN++23/O0Q4TmM4A0= =T7wJ -----END PGP SIGNATURE----- Merge tag 'buftarg-cleanups-6.9_2024-02-23' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into xfs-6.9-mergeC xfs: buftarg cleanups Clean up the buffer target code in preparation for adding the ability to target tmpfs files. That will enable the creation of in memory btrees. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org> * tag 'buftarg-cleanups-6.9_2024-02-23' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux: xfs: move setting bt_logical_sectorsize out of xfs_setsize_buftarg xfs: remove xfs_setsize_buftarg_early xfs: remove the xfs_buftarg_t typedef
This commit is contained in:
commit
aa8fb4bb7d
|
|
@ -1980,7 +1980,7 @@ xfs_free_buftarg(
|
|||
|
||||
int
|
||||
xfs_setsize_buftarg(
|
||||
xfs_buftarg_t *btp,
|
||||
struct xfs_buftarg *btp,
|
||||
unsigned int sectorsize)
|
||||
{
|
||||
/* Set up metadata sector size info */
|
||||
|
|
@ -1994,31 +1994,15 @@ xfs_setsize_buftarg(
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Set up device logical sector size mask */
|
||||
btp->bt_logical_sectorsize = bdev_logical_block_size(btp->bt_bdev);
|
||||
btp->bt_logical_sectormask = bdev_logical_block_size(btp->bt_bdev) - 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* When allocating the initial buffer target we have not yet
|
||||
* read in the superblock, so don't know what sized sectors
|
||||
* are being used at this early stage. Play safe.
|
||||
*/
|
||||
STATIC int
|
||||
xfs_setsize_buftarg_early(
|
||||
xfs_buftarg_t *btp)
|
||||
{
|
||||
return xfs_setsize_buftarg(btp, bdev_logical_block_size(btp->bt_bdev));
|
||||
}
|
||||
|
||||
struct xfs_buftarg *
|
||||
xfs_alloc_buftarg(
|
||||
struct xfs_mount *mp,
|
||||
struct bdev_handle *bdev_handle)
|
||||
{
|
||||
xfs_buftarg_t *btp;
|
||||
struct xfs_buftarg *btp;
|
||||
const struct dax_holder_operations *ops = NULL;
|
||||
|
||||
#if defined(CONFIG_FS_DAX) && defined(CONFIG_MEMORY_FAILURE)
|
||||
|
|
@ -2033,6 +2017,17 @@ xfs_alloc_buftarg(
|
|||
btp->bt_daxdev = fs_dax_get_by_bdev(btp->bt_bdev, &btp->bt_dax_part_off,
|
||||
mp, ops);
|
||||
|
||||
/*
|
||||
* When allocating the buftargs we have not yet read the super block and
|
||||
* thus don't know the file system sector size yet.
|
||||
*/
|
||||
if (xfs_setsize_buftarg(btp, bdev_logical_block_size(btp->bt_bdev)))
|
||||
goto error_free;
|
||||
|
||||
/* Set up device logical sector size mask */
|
||||
btp->bt_logical_sectorsize = bdev_logical_block_size(btp->bt_bdev);
|
||||
btp->bt_logical_sectormask = bdev_logical_block_size(btp->bt_bdev) - 1;
|
||||
|
||||
/*
|
||||
* Buffer IO error rate limiting. Limit it to no more than 10 messages
|
||||
* per 30 seconds so as to not spam logs too much on repeated errors.
|
||||
|
|
@ -2040,9 +2035,6 @@ xfs_alloc_buftarg(
|
|||
ratelimit_state_init(&btp->bt_ioerror_rl, 30 * HZ,
|
||||
DEFAULT_RATELIMIT_BURST);
|
||||
|
||||
if (xfs_setsize_buftarg_early(btp))
|
||||
goto error_free;
|
||||
|
||||
if (list_lru_init(&btp->bt_lru))
|
||||
goto error_free;
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ typedef unsigned int xfs_buf_flags_t;
|
|||
* The latter is derived from the underlying device, and controls direct IO
|
||||
* alignment constraints.
|
||||
*/
|
||||
typedef struct xfs_buftarg {
|
||||
struct xfs_buftarg {
|
||||
dev_t bt_dev;
|
||||
struct bdev_handle *bt_bdev_handle;
|
||||
struct block_device *bt_bdev;
|
||||
|
|
@ -114,7 +114,7 @@ typedef struct xfs_buftarg {
|
|||
|
||||
struct percpu_counter bt_io_count;
|
||||
struct ratelimit_state bt_ioerror_rl;
|
||||
} xfs_buftarg_t;
|
||||
};
|
||||
|
||||
#define XB_PAGES 2
|
||||
|
||||
|
|
|
|||
|
|
@ -633,14 +633,14 @@ xlog_state_release_iclog(
|
|||
*/
|
||||
int
|
||||
xfs_log_mount(
|
||||
xfs_mount_t *mp,
|
||||
xfs_buftarg_t *log_target,
|
||||
xfs_daddr_t blk_offset,
|
||||
int num_bblks)
|
||||
xfs_mount_t *mp,
|
||||
struct xfs_buftarg *log_target,
|
||||
xfs_daddr_t blk_offset,
|
||||
int num_bblks)
|
||||
{
|
||||
struct xlog *log;
|
||||
int error = 0;
|
||||
int min_logfsbs;
|
||||
struct xlog *log;
|
||||
int error = 0;
|
||||
int min_logfsbs;
|
||||
|
||||
if (!xfs_has_norecovery(mp)) {
|
||||
xfs_notice(mp, "Mounting V%d Filesystem %pU",
|
||||
|
|
|
|||
|
|
@ -94,9 +94,9 @@ typedef struct xfs_mount {
|
|||
struct xfs_inode *m_rsumip; /* pointer to summary inode */
|
||||
struct xfs_inode *m_rootip; /* pointer to root directory */
|
||||
struct xfs_quotainfo *m_quotainfo; /* disk quota information */
|
||||
xfs_buftarg_t *m_ddev_targp; /* saves taking the address */
|
||||
xfs_buftarg_t *m_logdev_targp;/* ptr to log device */
|
||||
xfs_buftarg_t *m_rtdev_targp; /* ptr to rt device */
|
||||
struct xfs_buftarg *m_ddev_targp; /* data device */
|
||||
struct xfs_buftarg *m_logdev_targp;/* log device */
|
||||
struct xfs_buftarg *m_rtdev_targp; /* rt device */
|
||||
void __percpu *m_inodegc; /* percpu inodegc structures */
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user