Skip to content

Commit 13d3c1a

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: move xfs_dquot_tree calls into xfs_qm_dqget_cache_{lookup,insert}
These are the low-level functions that needs them, so localize the (trivial) calculation of the radix tree root there. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
1 parent b6d2ab2 commit 13d3c1a

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

fs/xfs/xfs_dquot.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -801,10 +801,11 @@ xfs_dq_get_next_id(
801801
static struct xfs_dquot *
802802
xfs_qm_dqget_cache_lookup(
803803
struct xfs_mount *mp,
804-
struct xfs_quotainfo *qi,
805-
struct radix_tree_root *tree,
806-
xfs_dqid_t id)
804+
xfs_dqid_t id,
805+
xfs_dqtype_t type)
807806
{
807+
struct xfs_quotainfo *qi = mp->m_quotainfo;
808+
struct radix_tree_root *tree = xfs_dquot_tree(qi, type);
808809
struct xfs_dquot *dqp;
809810

810811
restart:
@@ -843,11 +844,12 @@ xfs_qm_dqget_cache_lookup(
843844
static int
844845
xfs_qm_dqget_cache_insert(
845846
struct xfs_mount *mp,
846-
struct xfs_quotainfo *qi,
847-
struct radix_tree_root *tree,
848847
xfs_dqid_t id,
848+
xfs_dqtype_t type,
849849
struct xfs_dquot *dqp)
850850
{
851+
struct xfs_quotainfo *qi = mp->m_quotainfo;
852+
struct radix_tree_root *tree = xfs_dquot_tree(qi, type);
851853
unsigned int nofs_flags;
852854
int error;
853855

@@ -905,8 +907,6 @@ xfs_qm_dqget(
905907
bool can_alloc,
906908
struct xfs_dquot **O_dqpp)
907909
{
908-
struct xfs_quotainfo *qi = mp->m_quotainfo;
909-
struct radix_tree_root *tree = xfs_dquot_tree(qi, type);
910910
struct xfs_dquot *dqp;
911911
int error;
912912

@@ -915,15 +915,15 @@ xfs_qm_dqget(
915915
return error;
916916

917917
restart:
918-
dqp = xfs_qm_dqget_cache_lookup(mp, qi, tree, id);
918+
dqp = xfs_qm_dqget_cache_lookup(mp, id, type);
919919
if (dqp)
920920
goto found;
921921

922922
error = xfs_qm_dqread(mp, id, type, can_alloc, &dqp);
923923
if (error)
924924
return error;
925925

926-
error = xfs_qm_dqget_cache_insert(mp, qi, tree, id, dqp);
926+
error = xfs_qm_dqget_cache_insert(mp, id, type, dqp);
927927
if (error) {
928928
xfs_qm_dqdestroy(dqp);
929929
if (error == -EEXIST) {
@@ -996,8 +996,6 @@ xfs_qm_dqget_inode(
996996
struct xfs_dquot **dqpp)
997997
{
998998
struct xfs_mount *mp = ip->i_mount;
999-
struct xfs_quotainfo *qi = mp->m_quotainfo;
1000-
struct radix_tree_root *tree = xfs_dquot_tree(qi, type);
1001999
struct xfs_dquot *dqp;
10021000
xfs_dqid_t id;
10031001
int error;
@@ -1016,7 +1014,7 @@ xfs_qm_dqget_inode(
10161014
id = xfs_qm_id_for_quotatype(ip, type);
10171015

10181016
restart:
1019-
dqp = xfs_qm_dqget_cache_lookup(mp, qi, tree, id);
1017+
dqp = xfs_qm_dqget_cache_lookup(mp, id, type);
10201018
if (dqp)
10211019
goto found;
10221020

@@ -1052,7 +1050,7 @@ xfs_qm_dqget_inode(
10521050
return -ESRCH;
10531051
}
10541052

1055-
error = xfs_qm_dqget_cache_insert(mp, qi, tree, id, dqp);
1053+
error = xfs_qm_dqget_cache_insert(mp, id, type, dqp);
10561054
if (error) {
10571055
xfs_qm_dqdestroy(dqp);
10581056
if (error == -EEXIST) {

0 commit comments

Comments
 (0)