2
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
2
* Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
4
4
* This program is free software; you can redistribute it and/or modify it
5
5
* under the terms of version 2 of the GNU General Public License as
6
6
* published by the Free Software Foundation.
8
8
* This program is distributed in the hope that it would be useful, but
9
9
* WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
12
* Further, this software is distributed without any warranty that it is
13
13
* free of the rightful claim of any third person regarding infringement
14
14
* or the like. Any license provided herein, whether implied or
15
15
* otherwise, applies only to this software file. Patent licenses, if
16
16
* any, provided herein do not apply to combinations of this program with
17
17
* other software, or any other product whatsoever.
19
19
* You should have received a copy of the GNU General Public License along
20
20
* with this program; if not, write the Free Software Foundation, Inc., 59
21
21
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
23
23
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24
24
* Mountain View, CA 94043, or:
28
* For further information regarding this notice, see:
28
* For further information regarding this notice, see:
30
30
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
34
34
* Free realtime space allocation for XFS.
39
extern int xfs_lowbit32(__uint32_t);
40
42
* Get a buffer for the bitmap or summary file block specified.
46
48
xfs_trans_t *tp, /* transaction pointer */
47
49
xfs_rtblock_t block, /* block number in bitmap or summary */
48
50
int issum, /* is summary not bitmap */
49
xfs_buf_t **bpp) /* output: buffer for the block */
51
xfs_buf_t **bpp) /* output: buffer for the block */
51
xfs_buf_t *bp; /* block buffer, result */
52
xfs_daddr_t d; /* disk addr of block */
53
xfs_buf_t *bp; /* block buffer, result */
54
xfs_daddr_t d; /* disk addr of block */
53
55
int error; /* error value */
54
56
xfs_fsblock_t fsb; /* fs block number for block */
55
57
xfs_inode_t *ip; /* bitmap or summary inode */
96
98
xfs_rtword_t *b; /* current word in buffer */
97
99
int bit; /* bit number in the word */
98
100
xfs_rtblock_t block; /* bitmap block number */
99
xfs_buf_t *bp; /* buf for the block */
101
xfs_buf_t *bp; /* buf for the block */
100
102
xfs_rtword_t *bufp; /* starting word in buffer */
101
103
int error; /* error value */
102
104
xfs_rtblock_t firstbit; /* first useful bit in the word */
271
273
xfs_rtword_t *b; /* current word in buffer */
272
274
int bit; /* bit number in the word */
273
275
xfs_rtblock_t block; /* bitmap block number */
274
xfs_buf_t *bp; /* buf for the block */
276
xfs_buf_t *bp; /* buf for the block */
275
277
xfs_rtword_t *bufp; /* starting word in buffer */
276
278
int error; /* error value */
277
279
xfs_rtblock_t i; /* current bit number rel. to start */
436
438
xfs_trans_t *tp, /* transaction pointer */
437
439
xfs_rtblock_t start, /* starting block to free */
438
440
xfs_extlen_t len, /* length to free */
439
xfs_buf_t **rbpp, /* in/out: summary block buffer */
441
xfs_buf_t **rbpp, /* in/out: summary block buffer */
440
442
xfs_fsblock_t *rsb) /* in/out: summary block number */
442
444
xfs_rtblock_t end; /* end of the freed extent */
670
672
int log, /* log2 of extent size */
671
673
xfs_rtblock_t bbno, /* bitmap block number */
672
674
int delta, /* change to make to summary info */
673
xfs_buf_t **rbpp, /* in/out: summary block buffer */
675
xfs_buf_t **rbpp, /* in/out: summary block buffer */
674
676
xfs_fsblock_t *rsb) /* in/out: summary block number */
676
xfs_buf_t *bp; /* buffer for the summary block */
678
xfs_buf_t *bp; /* buffer for the summary block */
677
679
int error; /* error value */
678
680
xfs_fsblock_t sb; /* summary fsblock */
679
681
int so; /* index into the summary file */
737
739
xfs_inode_t *ip; /* bitmap file inode */
738
740
xfs_mount_t *mp; /* file system mount structure */
739
741
xfs_fsblock_t sb; /* summary file block number */
740
xfs_buf_t *sumbp; /* summary file block buffer */
742
xfs_buf_t *sumbp; /* summary file block buffer */
742
744
mp = tp->t_mountp;
791
* Initialize realtime fields in the mount structure.
795
xfs_mount_t *mp) /* file system mount structure */
797
xfs_buf_t *bp; /* buffer for last block of subvolume */
798
xfs_daddr_t d; /* address of last block of subvolume */
799
int error; /* error return value */
800
xfs_sb_t *sbp; /* filesystem superblock copy in mount */
803
if (sbp->sb_rblocks == 0)
807
"XFS: This FS has an RT subvol - specify -o rtdev on mount\n");
808
return XFS_ERROR(ENODEV);
810
mp->m_rsumlevels = sbp->sb_rextslog + 1;
812
(uint)sizeof(xfs_suminfo_t) * mp->m_rsumlevels *
814
mp->m_rsumsize = roundup(mp->m_rsumsize, sbp->sb_blocksize);
815
mp->m_rbmip = mp->m_rsumip = NULL;
817
* Check that the realtime section is an ok size.
819
d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_rblocks);
820
if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_rblocks) {
821
printk(KERN_WARNING "XFS: RT mount - %llu != %llu\n",
822
(unsigned long long) XFS_BB_TO_FSB(mp, d),
823
(unsigned long long) mp->m_sb.sb_rblocks);
824
return XFS_ERROR(E2BIG);
826
error = xfs_read_buf(mp, m_rtdev_targp(mp), d - 1, 1, 0, &bp);
829
"XFS: RT mount - xfs_read_buf returned %d\n", error);
831
return XFS_ERROR(E2BIG);