aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/nilfs2_fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/nilfs2_fs.h')
-rw-r--r--include/linux/nilfs2_fs.h54
1 files changed, 25 insertions, 29 deletions
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index f5487b6f91ed..7454ad7451b4 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -4,16 +4,16 @@
4 * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. 4 * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU Lesser General Public License as published
8 * the Free Software Foundation; either version 2 of the License, or 8 * by the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version. 9 * (at your option) any later version.
10 * 10 *
11 * This program is distributed in the hope that it will be useful, 11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU Lesser General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU General Public License 16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 * 19 *
@@ -40,26 +40,7 @@
40 40
41#include <linux/types.h> 41#include <linux/types.h>
42#include <linux/ioctl.h> 42#include <linux/ioctl.h>
43 43#include <linux/magic.h>
44/*
45 * Inode flags stored in nilfs_inode and on-memory nilfs inode
46 *
47 * We define these flags based on ext2-fs because of the
48 * compatibility reason; to avoid problems in chattr(1)
49 */
50#define NILFS_SECRM_FL 0x00000001 /* Secure deletion */
51#define NILFS_UNRM_FL 0x00000002 /* Undelete */
52#define NILFS_SYNC_FL 0x00000008 /* Synchronous updates */
53#define NILFS_IMMUTABLE_FL 0x00000010 /* Immutable file */
54#define NILFS_APPEND_FL 0x00000020 /* writes to file may only append */
55#define NILFS_NODUMP_FL 0x00000040 /* do not dump file */
56#define NILFS_NOATIME_FL 0x00000080 /* do not update atime */
57/* Reserved for compression usage... */
58#define NILFS_NOTAIL_FL 0x00008000 /* file tail should not be merged */
59#define NILFS_DIRSYNC_FL 0x00010000 /* dirsync behaviour */
60
61#define NILFS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
62#define NILFS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
63 44
64 45
65#define NILFS_INODE_BMAP_SIZE 7 46#define NILFS_INODE_BMAP_SIZE 7
@@ -126,7 +107,7 @@ struct nilfs_super_root {
126#define NILFS_SR_DAT_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 0) 107#define NILFS_SR_DAT_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 0)
127#define NILFS_SR_CPFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 1) 108#define NILFS_SR_CPFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 1)
128#define NILFS_SR_SUFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 2) 109#define NILFS_SR_SUFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 2)
129#define NILFS_SR_BYTES (sizeof(struct nilfs_super_root)) 110#define NILFS_SR_BYTES(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 3)
130 111
131/* 112/*
132 * Maximal mount counts 113 * Maximal mount counts
@@ -147,7 +128,6 @@ struct nilfs_super_root {
147#define NILFS_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */ 128#define NILFS_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */
148#define NILFS_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */ 129#define NILFS_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */
149#define NILFS_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */ 130#define NILFS_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */
150#define NILFS_MOUNT_SNAPSHOT 0x0080 /* Snapshot flag */
151#define NILFS_MOUNT_BARRIER 0x1000 /* Use block barriers */ 131#define NILFS_MOUNT_BARRIER 0x1000 /* Use block barriers */
152#define NILFS_MOUNT_STRICT_ORDER 0x2000 /* Apply strict in-order 132#define NILFS_MOUNT_STRICT_ORDER 0x2000 /* Apply strict in-order
153 semantics also for data */ 133 semantics also for data */
@@ -229,6 +209,7 @@ struct nilfs_super_block {
229 */ 209 */
230#define NILFS_CURRENT_REV 2 /* current major revision */ 210#define NILFS_CURRENT_REV 2 /* current major revision */
231#define NILFS_MINOR_REV 0 /* minor revision */ 211#define NILFS_MINOR_REV 0 /* minor revision */
212#define NILFS_MIN_SUPP_REV 2 /* minimum supported revision */
232 213
233/* 214/*
234 * Feature set definitions 215 * Feature set definitions
@@ -236,8 +217,10 @@ struct nilfs_super_block {
236 * If there is a bit set in the incompatible feature set that the kernel 217 * If there is a bit set in the incompatible feature set that the kernel
237 * doesn't know about, it should refuse to mount the filesystem. 218 * doesn't know about, it should refuse to mount the filesystem.
238 */ 219 */
220#define NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT 0x00000001ULL
221
239#define NILFS_FEATURE_COMPAT_SUPP 0ULL 222#define NILFS_FEATURE_COMPAT_SUPP 0ULL
240#define NILFS_FEATURE_COMPAT_RO_SUPP 0ULL 223#define NILFS_FEATURE_COMPAT_RO_SUPP NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT
241#define NILFS_FEATURE_INCOMPAT_SUPP 0ULL 224#define NILFS_FEATURE_INCOMPAT_SUPP 0ULL
242 225
243/* 226/*
@@ -260,7 +243,6 @@ struct nilfs_super_block {
260#define NILFS_USER_INO 11 /* Fisrt user's file inode number */ 243#define NILFS_USER_INO 11 /* Fisrt user's file inode number */
261 244
262#define NILFS_SB_OFFSET_BYTES 1024 /* byte offset of nilfs superblock */ 245#define NILFS_SB_OFFSET_BYTES 1024 /* byte offset of nilfs superblock */
263#define NILFS_SUPER_MAGIC 0x3434 /* NILFS filesystem magic number */
264 246
265#define NILFS_SEG_MIN_BLOCKS 16 /* Minimum number of blocks in 247#define NILFS_SEG_MIN_BLOCKS 16 /* Minimum number of blocks in
266 a full segment */ 248 a full segment */
@@ -270,6 +252,14 @@ struct nilfs_super_block {
270 segments */ 252 segments */
271 253
272/* 254/*
255 * We call DAT, cpfile, and sufile root metadata files. Inodes of
256 * these files are written in super root block instead of ifile, and
257 * garbage collector doesn't keep any past versions of these files.
258 */
259#define NILFS_ROOT_METADATA_FILE(ino) \
260 ((ino) >= NILFS_DAT_INO && (ino) <= NILFS_SUFILE_INO)
261
262/*
273 * bytes offset of secondary super block 263 * bytes offset of secondary super block
274 */ 264 */
275#define NILFS_SB2_OFFSET_BYTES(devsize) ((((devsize) >> 12) - 1) << 12) 265#define NILFS_SB2_OFFSET_BYTES(devsize) ((((devsize) >> 12) - 1) << 12)
@@ -338,17 +328,21 @@ static inline unsigned nilfs_rec_len_from_disk(__le16 dlen)
338{ 328{
339 unsigned len = le16_to_cpu(dlen); 329 unsigned len = le16_to_cpu(dlen);
340 330
331#if !defined(__KERNEL__) || (PAGE_CACHE_SIZE >= 65536)
341 if (len == NILFS_MAX_REC_LEN) 332 if (len == NILFS_MAX_REC_LEN)
342 return 1 << 16; 333 return 1 << 16;
334#endif
343 return len; 335 return len;
344} 336}
345 337
346static inline __le16 nilfs_rec_len_to_disk(unsigned len) 338static inline __le16 nilfs_rec_len_to_disk(unsigned len)
347{ 339{
340#if !defined(__KERNEL__) || (PAGE_CACHE_SIZE >= 65536)
348 if (len == (1 << 16)) 341 if (len == (1 << 16))
349 return cpu_to_le16(NILFS_MAX_REC_LEN); 342 return cpu_to_le16(NILFS_MAX_REC_LEN);
350 else if (len > (1 << 16)) 343 else if (len > (1 << 16))
351 BUG(); 344 BUG();
345#endif
352 return cpu_to_le16(len); 346 return cpu_to_le16(len);
353} 347}
354 348
@@ -517,7 +511,7 @@ struct nilfs_checkpoint {
517 __le64 cp_create; 511 __le64 cp_create;
518 __le64 cp_nblk_inc; 512 __le64 cp_nblk_inc;
519 __le64 cp_inodes_count; 513 __le64 cp_inodes_count;
520 __le64 cp_blocks_count; /* Reserved (might be deleted) */ 514 __le64 cp_blocks_count;
521 515
522 /* Do not change the byte offset of ifile inode. 516 /* Do not change the byte offset of ifile inode.
523 To keep the compatibility of the disk format, 517 To keep the compatibility of the disk format,
@@ -851,5 +845,7 @@ struct nilfs_bdesc {
851 _IOR(NILFS_IOCTL_IDENT, 0x8A, __u64) 845 _IOR(NILFS_IOCTL_IDENT, 0x8A, __u64)
852#define NILFS_IOCTL_RESIZE \ 846#define NILFS_IOCTL_RESIZE \
853 _IOW(NILFS_IOCTL_IDENT, 0x8B, __u64) 847 _IOW(NILFS_IOCTL_IDENT, 0x8B, __u64)
848#define NILFS_IOCTL_SET_ALLOC_RANGE \
849 _IOW(NILFS_IOCTL_IDENT, 0x8C, __u64[2])
854 850
855#endif /* _LINUX_NILFS_FS_H */ 851#endif /* _LINUX_NILFS_FS_H */