aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2015-02-23 05:24:37 -0500
committerDave Chinner <david@fromorbit.com>2015-02-23 05:24:37 -0500
commit964aa8d9e4d36e0e54a88683d14c7d5b9d02aed8 (patch)
treebd06ac66290e88c8205a10d7663dc1c9d74f53c8 /fs/xfs
parent0bd5ddedccca4451ac2390d1155b4ab74b990eff (diff)
xfs: remove xfs_mod_incore_sb API
Now that there are no users of the bitfield based incore superblock modification API, just remove the whole damn lot of it, including all the bitfield definitions. This finally removes a lot of cruft that has been around for a long time. Credit goes to Christoph Hellwig for providing a great patch connecting all the dots to enale us to do this. This patch is derived from that work. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/libxfs/xfs_format.h62
-rw-r--r--fs/xfs/xfs_fsops.c4
-rw-r--r--fs/xfs/xfs_mount.c136
-rw-r--r--fs/xfs/xfs_mount.h3
4 files changed, 1 insertions, 204 deletions
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
index 8eb718979383..4daaa662337b 100644
--- a/fs/xfs/libxfs/xfs_format.h
+++ b/fs/xfs/libxfs/xfs_format.h
@@ -264,68 +264,6 @@ typedef struct xfs_dsb {
264 /* must be padded to 64 bit alignment */ 264 /* must be padded to 64 bit alignment */
265} xfs_dsb_t; 265} xfs_dsb_t;
266 266
267/*
268 * Sequence number values for the fields.
269 */
270typedef enum {
271 XFS_SBS_MAGICNUM, XFS_SBS_BLOCKSIZE, XFS_SBS_DBLOCKS, XFS_SBS_RBLOCKS,
272 XFS_SBS_REXTENTS, XFS_SBS_UUID, XFS_SBS_LOGSTART, XFS_SBS_ROOTINO,
273 XFS_SBS_RBMINO, XFS_SBS_RSUMINO, XFS_SBS_REXTSIZE, XFS_SBS_AGBLOCKS,
274 XFS_SBS_AGCOUNT, XFS_SBS_RBMBLOCKS, XFS_SBS_LOGBLOCKS,
275 XFS_SBS_VERSIONNUM, XFS_SBS_SECTSIZE, XFS_SBS_INODESIZE,
276 XFS_SBS_INOPBLOCK, XFS_SBS_FNAME, XFS_SBS_BLOCKLOG,
277 XFS_SBS_SECTLOG, XFS_SBS_INODELOG, XFS_SBS_INOPBLOG, XFS_SBS_AGBLKLOG,
278 XFS_SBS_REXTSLOG, XFS_SBS_INPROGRESS, XFS_SBS_IMAX_PCT, XFS_SBS_ICOUNT,
279 XFS_SBS_IFREE, XFS_SBS_FDBLOCKS, XFS_SBS_FREXTENTS, XFS_SBS_UQUOTINO,
280 XFS_SBS_GQUOTINO, XFS_SBS_QFLAGS, XFS_SBS_FLAGS, XFS_SBS_SHARED_VN,
281 XFS_SBS_INOALIGNMT, XFS_SBS_UNIT, XFS_SBS_WIDTH, XFS_SBS_DIRBLKLOG,
282 XFS_SBS_LOGSECTLOG, XFS_SBS_LOGSECTSIZE, XFS_SBS_LOGSUNIT,
283 XFS_SBS_FEATURES2, XFS_SBS_BAD_FEATURES2, XFS_SBS_FEATURES_COMPAT,
284 XFS_SBS_FEATURES_RO_COMPAT, XFS_SBS_FEATURES_INCOMPAT,
285 XFS_SBS_FEATURES_LOG_INCOMPAT, XFS_SBS_CRC, XFS_SBS_PAD,
286 XFS_SBS_PQUOTINO, XFS_SBS_LSN,
287 XFS_SBS_FIELDCOUNT
288} xfs_sb_field_t;
289
290/*
291 * Mask values, defined based on the xfs_sb_field_t values.
292 * Only define the ones we're using.
293 */
294#define XFS_SB_MVAL(x) (1LL << XFS_SBS_ ## x)
295#define XFS_SB_UUID XFS_SB_MVAL(UUID)
296#define XFS_SB_FNAME XFS_SB_MVAL(FNAME)
297#define XFS_SB_ROOTINO XFS_SB_MVAL(ROOTINO)
298#define XFS_SB_RBMINO XFS_SB_MVAL(RBMINO)
299#define XFS_SB_RSUMINO XFS_SB_MVAL(RSUMINO)
300#define XFS_SB_VERSIONNUM XFS_SB_MVAL(VERSIONNUM)
301#define XFS_SB_UQUOTINO XFS_SB_MVAL(UQUOTINO)
302#define XFS_SB_GQUOTINO XFS_SB_MVAL(GQUOTINO)
303#define XFS_SB_QFLAGS XFS_SB_MVAL(QFLAGS)
304#define XFS_SB_SHARED_VN XFS_SB_MVAL(SHARED_VN)
305#define XFS_SB_UNIT XFS_SB_MVAL(UNIT)
306#define XFS_SB_WIDTH XFS_SB_MVAL(WIDTH)
307#define XFS_SB_ICOUNT XFS_SB_MVAL(ICOUNT)
308#define XFS_SB_IFREE XFS_SB_MVAL(IFREE)
309#define XFS_SB_FDBLOCKS XFS_SB_MVAL(FDBLOCKS)
310#define XFS_SB_FEATURES2 (XFS_SB_MVAL(FEATURES2) | \
311 XFS_SB_MVAL(BAD_FEATURES2))
312#define XFS_SB_FEATURES_COMPAT XFS_SB_MVAL(FEATURES_COMPAT)
313#define XFS_SB_FEATURES_RO_COMPAT XFS_SB_MVAL(FEATURES_RO_COMPAT)
314#define XFS_SB_FEATURES_INCOMPAT XFS_SB_MVAL(FEATURES_INCOMPAT)
315#define XFS_SB_FEATURES_LOG_INCOMPAT XFS_SB_MVAL(FEATURES_LOG_INCOMPAT)
316#define XFS_SB_CRC XFS_SB_MVAL(CRC)
317#define XFS_SB_PQUOTINO XFS_SB_MVAL(PQUOTINO)
318#define XFS_SB_NUM_BITS ((int)XFS_SBS_FIELDCOUNT)
319#define XFS_SB_ALL_BITS ((1LL << XFS_SB_NUM_BITS) - 1)
320#define XFS_SB_MOD_BITS \
321 (XFS_SB_UUID | XFS_SB_ROOTINO | XFS_SB_RBMINO | XFS_SB_RSUMINO | \
322 XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | XFS_SB_GQUOTINO | \
323 XFS_SB_QFLAGS | XFS_SB_SHARED_VN | XFS_SB_UNIT | XFS_SB_WIDTH | \
324 XFS_SB_ICOUNT | XFS_SB_IFREE | XFS_SB_FDBLOCKS | XFS_SB_FEATURES2 | \
325 XFS_SB_FEATURES_COMPAT | XFS_SB_FEATURES_RO_COMPAT | \
326 XFS_SB_FEATURES_INCOMPAT | XFS_SB_FEATURES_LOG_INCOMPAT | \
327 XFS_SB_PQUOTINO)
328
329 267
330/* 268/*
331 * Misc. Flags - warning - these will be cleared by xfs_repair unless 269 * Misc. Flags - warning - these will be cleared by xfs_repair unless
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 16e62edc9dae..cb7e8a29dfb6 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -693,10 +693,6 @@ xfs_reserve_blocks(
693 * what to do. This means that the amount of free space can 693 * what to do. This means that the amount of free space can
694 * change while we do this, so we need to retry if we end up 694 * change while we do this, so we need to retry if we end up
695 * trying to reserve more space than is available. 695 * trying to reserve more space than is available.
696 *
697 * We also use the xfs_mod_incore_sb() interface so that we
698 * don't have to care about whether per cpu counter are
699 * enabled, disabled or even compiled in....
700 */ 696 */
701retry: 697retry:
702 spin_lock(&mp->m_sb_lock); 698 spin_lock(&mp->m_sb_lock);
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index d748aa73003b..2ce7ee3b4ec1 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -1217,142 +1217,6 @@ xfs_mod_frextents(
1217} 1217}
1218 1218
1219/* 1219/*
1220 * xfs_mod_incore_sb_unlocked() is a utility routine commonly used to apply
1221 * a delta to a specified field in the in-core superblock. Simply
1222 * switch on the field indicated and apply the delta to that field.
1223 * Fields are not allowed to dip below zero, so if the delta would
1224 * do this do not apply it and return EINVAL.
1225 *
1226 * The m_sb_lock must be held when this routine is called.
1227 */
1228STATIC int
1229xfs_mod_incore_sb_unlocked(
1230 xfs_mount_t *mp,
1231 xfs_sb_field_t field,
1232 int64_t delta,
1233 int rsvd)
1234{
1235 int scounter; /* short counter for 32 bit fields */
1236 long long lcounter; /* long counter for 64 bit fields */
1237
1238 /*
1239 * With the in-core superblock spin lock held, switch
1240 * on the indicated field. Apply the delta to the
1241 * proper field. If the fields value would dip below
1242 * 0, then do not apply the delta and return EINVAL.
1243 */
1244 switch (field) {
1245 case XFS_SBS_ICOUNT:
1246 case XFS_SBS_IFREE:
1247 case XFS_SBS_FDBLOCKS:
1248 case XFS_SBS_FREXTENTS:
1249 ASSERT(0);
1250 return -EINVAL;
1251 case XFS_SBS_DBLOCKS:
1252 lcounter = (long long)mp->m_sb.sb_dblocks;
1253 lcounter += delta;
1254 if (lcounter < 0) {
1255 ASSERT(0);
1256 return -EINVAL;
1257 }
1258 mp->m_sb.sb_dblocks = lcounter;
1259 return 0;
1260 case XFS_SBS_AGCOUNT:
1261 scounter = mp->m_sb.sb_agcount;
1262 scounter += delta;
1263 if (scounter < 0) {
1264 ASSERT(0);
1265 return -EINVAL;
1266 }
1267 mp->m_sb.sb_agcount = scounter;
1268 return 0;
1269 case XFS_SBS_IMAX_PCT:
1270 scounter = mp->m_sb.sb_imax_pct;
1271 scounter += delta;
1272 if (scounter < 0) {
1273 ASSERT(0);
1274 return -EINVAL;
1275 }
1276 mp->m_sb.sb_imax_pct = scounter;
1277 return 0;
1278 case XFS_SBS_REXTSIZE:
1279 scounter = mp->m_sb.sb_rextsize;
1280 scounter += delta;
1281 if (scounter < 0) {
1282 ASSERT(0);
1283 return -EINVAL;
1284 }
1285 mp->m_sb.sb_rextsize = scounter;
1286 return 0;
1287 case XFS_SBS_RBMBLOCKS:
1288 scounter = mp->m_sb.sb_rbmblocks;
1289 scounter += delta;
1290 if (scounter < 0) {
1291 ASSERT(0);
1292 return -EINVAL;
1293 }
1294 mp->m_sb.sb_rbmblocks = scounter;
1295 return 0;
1296 case XFS_SBS_RBLOCKS:
1297 lcounter = (long long)mp->m_sb.sb_rblocks;
1298 lcounter += delta;
1299 if (lcounter < 0) {
1300 ASSERT(0);
1301 return -EINVAL;
1302 }
1303 mp->m_sb.sb_rblocks = lcounter;
1304 return 0;
1305 case XFS_SBS_REXTENTS:
1306 lcounter = (long long)mp->m_sb.sb_rextents;
1307 lcounter += delta;
1308 if (lcounter < 0) {
1309 ASSERT(0);
1310 return -EINVAL;
1311 }
1312 mp->m_sb.sb_rextents = lcounter;
1313 return 0;
1314 case XFS_SBS_REXTSLOG:
1315 scounter = mp->m_sb.sb_rextslog;
1316 scounter += delta;
1317 if (scounter < 0) {
1318 ASSERT(0);
1319 return -EINVAL;
1320 }
1321 mp->m_sb.sb_rextslog = scounter;
1322 return 0;
1323 default:
1324 ASSERT(0);
1325 return -EINVAL;
1326 }
1327}
1328
1329/*
1330 * xfs_mod_incore_sb() is used to change a field in the in-core
1331 * superblock structure by the specified delta. This modification
1332 * is protected by the m_sb_lock. Just use the xfs_mod_incore_sb_unlocked()
1333 * routine to do the work.
1334 */
1335int
1336xfs_mod_incore_sb(
1337 struct xfs_mount *mp,
1338 xfs_sb_field_t field,
1339 int64_t delta,
1340 int rsvd)
1341{
1342 int status;
1343
1344#ifdef HAVE_PERCPU_SB
1345 ASSERT(field < XFS_SBS_IFREE || field > XFS_SBS_FDBLOCKS);
1346#endif
1347
1348 spin_lock(&mp->m_sb_lock);
1349 status = xfs_mod_incore_sb_unlocked(mp, field, delta, rsvd);
1350 spin_unlock(&mp->m_sb_lock);
1351
1352 return status;
1353}
1354
1355/*
1356 * xfs_getsb() is called to obtain the buffer for the superblock. 1220 * xfs_getsb() is called to obtain the buffer for the superblock.
1357 * The buffer is returned locked and read in from disk. 1221 * The buffer is returned locked and read in from disk.
1358 * The buffer should be released with a call to xfs_brelse(). 1222 * The buffer should be released with a call to xfs_brelse().
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 1c11512bab83..8c995a2ccb6f 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -313,9 +313,8 @@ extern __uint64_t xfs_default_resblks(xfs_mount_t *mp);
313extern int xfs_mountfs(xfs_mount_t *mp); 313extern int xfs_mountfs(xfs_mount_t *mp);
314extern int xfs_initialize_perag(xfs_mount_t *mp, xfs_agnumber_t agcount, 314extern int xfs_initialize_perag(xfs_mount_t *mp, xfs_agnumber_t agcount,
315 xfs_agnumber_t *maxagi); 315 xfs_agnumber_t *maxagi);
316
317extern void xfs_unmountfs(xfs_mount_t *); 316extern void xfs_unmountfs(xfs_mount_t *);
318extern int xfs_mod_incore_sb(xfs_mount_t *, xfs_sb_field_t, int64_t, int); 317
319extern int xfs_mod_icount(struct xfs_mount *mp, int64_t delta); 318extern int xfs_mod_icount(struct xfs_mount *mp, int64_t delta);
320extern int xfs_mod_ifree(struct xfs_mount *mp, int64_t delta); 319extern int xfs_mod_ifree(struct xfs_mount *mp, int64_t delta);
321extern int xfs_mod_fdblocks(struct xfs_mount *mp, int64_t delta, 320extern int xfs_mod_fdblocks(struct xfs_mount *mp, int64_t delta,