diff options
author | Eric Sandeen <sandeen@sandeen.net> | 2014-09-08 21:58:42 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-09-08 21:58:42 -0400 |
commit | afabfd30d05264ff493c24bce310b6a5350f099b (patch) | |
tree | 2e6a63c0ee02b51a89007d76e6d72996c88380c5 /fs/xfs/xfs_rtalloc.c | |
parent | b16ed7c114b8cca45fa87b675c431f43ff90c179 (diff) |
xfs: combine xfs_rtmodify_summary and xfs_rtget_summary
xfs_rtmodify_summary and xfs_rtget_summary are almost identical;
fold them into xfs_rtmodify_summary_int(), with wrappers for each of
the original calls.
The _int function modifies if a delta is passed, and returns a
summary pointer if *sum is passed.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_rtalloc.c')
-rw-r--r-- | fs/xfs/xfs_rtalloc.c | 55 |
1 files changed, 2 insertions, 53 deletions
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index 909e143b87ae..d1160cce5dad 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c | |||
@@ -46,7 +46,7 @@ | |||
46 | * Keeps track of a current summary block, so we don't keep reading | 46 | * Keeps track of a current summary block, so we don't keep reading |
47 | * it from the buffer cache. | 47 | * it from the buffer cache. |
48 | */ | 48 | */ |
49 | STATIC int /* error */ | 49 | int |
50 | xfs_rtget_summary( | 50 | xfs_rtget_summary( |
51 | xfs_mount_t *mp, /* file system mount structure */ | 51 | xfs_mount_t *mp, /* file system mount structure */ |
52 | xfs_trans_t *tp, /* transaction pointer */ | 52 | xfs_trans_t *tp, /* transaction pointer */ |
@@ -56,60 +56,9 @@ xfs_rtget_summary( | |||
56 | xfs_fsblock_t *rsb, /* in/out: summary block number */ | 56 | xfs_fsblock_t *rsb, /* in/out: summary block number */ |
57 | xfs_suminfo_t *sum) /* out: summary info for this block */ | 57 | xfs_suminfo_t *sum) /* out: summary info for this block */ |
58 | { | 58 | { |
59 | xfs_buf_t *bp; /* buffer for summary block */ | 59 | return xfs_rtmodify_summary_int(mp, tp, log, bbno, 0, rbpp, rsb, sum); |
60 | int error; /* error value */ | ||
61 | xfs_fsblock_t sb; /* summary fsblock */ | ||
62 | int so; /* index into the summary file */ | ||
63 | xfs_suminfo_t *sp; /* pointer to returned data */ | ||
64 | |||
65 | /* | ||
66 | * Compute entry number in the summary file. | ||
67 | */ | ||
68 | so = XFS_SUMOFFS(mp, log, bbno); | ||
69 | /* | ||
70 | * Compute the block number in the summary file. | ||
71 | */ | ||
72 | sb = XFS_SUMOFFSTOBLOCK(mp, so); | ||
73 | /* | ||
74 | * If we have an old buffer, and the block number matches, use that. | ||
75 | */ | ||
76 | if (rbpp && *rbpp && *rsb == sb) | ||
77 | bp = *rbpp; | ||
78 | /* | ||
79 | * Otherwise we have to get the buffer. | ||
80 | */ | ||
81 | else { | ||
82 | /* | ||
83 | * If there was an old one, get rid of it first. | ||
84 | */ | ||
85 | if (rbpp && *rbpp) | ||
86 | xfs_trans_brelse(tp, *rbpp); | ||
87 | error = xfs_rtbuf_get(mp, tp, sb, 1, &bp); | ||
88 | if (error) { | ||
89 | return error; | ||
90 | } | ||
91 | /* | ||
92 | * Remember this buffer and block for the next call. | ||
93 | */ | ||
94 | if (rbpp) { | ||
95 | *rbpp = bp; | ||
96 | *rsb = sb; | ||
97 | } | ||
98 | } | ||
99 | /* | ||
100 | * Point to the summary information & copy it out. | ||
101 | */ | ||
102 | sp = XFS_SUMPTR(mp, bp, so); | ||
103 | *sum = *sp; | ||
104 | /* | ||
105 | * Drop the buffer if we're not asked to remember it. | ||
106 | */ | ||
107 | if (!rbpp) | ||
108 | xfs_trans_brelse(tp, bp); | ||
109 | return 0; | ||
110 | } | 60 | } |
111 | 61 | ||
112 | |||
113 | /* | 62 | /* |
114 | * Return whether there are any free extents in the size range given | 63 | * Return whether there are any free extents in the size range given |
115 | * by low and high, for the bitmap block bbno. | 64 | * by low and high, for the bitmap block bbno. |