aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-07 13:10:55 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-07 13:10:55 -0700
commita57f9a3e811cf1246b394f0cc667c6bc5a52e099 (patch)
tree488b4dd7cd061e7e0e059acb8443967e21051aab /include
parentMerge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 (diff)
parentnilfs2: reject filesystem with unsupported block size (diff)
downloadlinux-dev-a57f9a3e811cf1246b394f0cc667c6bc5a52e099.tar.xz
linux-dev-a57f9a3e811cf1246b394f0cc667c6bc5a52e099.zip
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2: (45 commits) nilfs2: reject filesystem with unsupported block size nilfs2: avoid rec_len overflow with 64KB block size nilfs2: simplify nilfs_get_page function nilfs2: reject incompatible filesystem nilfs2: add feature set fields to super block nilfs2: clarify byte offset in super block format nilfs2: apply read-ahead for nilfs_btree_lookup_contig nilfs2: introduce check flag to btree node buffer nilfs2: add btree get block function with readahead option nilfs2: add read ahead mode to nilfs_btnode_submit_block nilfs2: fix buffer head leak in nilfs_btnode_submit_block nilfs2: eliminate inline keywords in btree implementation nilfs2: get maximum number of child nodes from bmap object nilfs2: reduce repetitive calculation of max number of child nodes nilfs2: optimize calculation of min/max number of btree node children nilfs2: remove redundant pointer checks in bmap lookup functions nilfs2: get rid of nilfs_bmap_union nilfs2: unify bmap set_target_v operations nilfs2: get rid of nilfs_btree uses nilfs2: get rid of nilfs_direct uses ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/nilfs2_fs.h65
1 files changed, 51 insertions, 14 deletions
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index 8c2c6116e788..f5487b6f91ed 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -160,7 +160,7 @@ struct nilfs_super_root {
* struct nilfs_super_block - structure of super block on disk
*/
struct nilfs_super_block {
- __le32 s_rev_level; /* Revision level */
+/*00*/ __le32 s_rev_level; /* Revision level */
__le16 s_minor_rev_level; /* minor revision level */
__le16 s_magic; /* Magic signature */
@@ -169,50 +169,53 @@ struct nilfs_super_block {
is excluded. */
__le16 s_flags; /* flags */
__le32 s_crc_seed; /* Seed value of CRC calculation */
- __le32 s_sum; /* Check sum of super block */
+/*10*/ __le32 s_sum; /* Check sum of super block */
__le32 s_log_block_size; /* Block size represented as follows
blocksize =
1 << (s_log_block_size + 10) */
__le64 s_nsegments; /* Number of segments in filesystem */
- __le64 s_dev_size; /* block device size in bytes */
+/*20*/ __le64 s_dev_size; /* block device size in bytes */
__le64 s_first_data_block; /* 1st seg disk block number */
- __le32 s_blocks_per_segment; /* number of blocks per full segment */
+/*30*/ __le32 s_blocks_per_segment; /* number of blocks per full segment */
__le32 s_r_segments_percentage; /* Reserved segments percentage */
__le64 s_last_cno; /* Last checkpoint number */
- __le64 s_last_pseg; /* disk block addr pseg written last */
+/*40*/ __le64 s_last_pseg; /* disk block addr pseg written last */
__le64 s_last_seq; /* seq. number of seg written last */
- __le64 s_free_blocks_count; /* Free blocks count */
+/*50*/ __le64 s_free_blocks_count; /* Free blocks count */
__le64 s_ctime; /* Creation time (execution time of
newfs) */
- __le64 s_mtime; /* Mount time */
+/*60*/ __le64 s_mtime; /* Mount time */
__le64 s_wtime; /* Write time */
- __le16 s_mnt_count; /* Mount count */
+/*70*/ __le16 s_mnt_count; /* Mount count */
__le16 s_max_mnt_count; /* Maximal mount count */
__le16 s_state; /* File system state */
__le16 s_errors; /* Behaviour when detecting errors */
__le64 s_lastcheck; /* time of last check */
- __le32 s_checkinterval; /* max. time between checks */
+/*80*/ __le32 s_checkinterval; /* max. time between checks */
__le32 s_creator_os; /* OS */
__le16 s_def_resuid; /* Default uid for reserved blocks */
__le16 s_def_resgid; /* Default gid for reserved blocks */
__le32 s_first_ino; /* First non-reserved inode */
- __le16 s_inode_size; /* Size of an inode */
+/*90*/ __le16 s_inode_size; /* Size of an inode */
__le16 s_dat_entry_size; /* Size of a dat entry */
__le16 s_checkpoint_size; /* Size of a checkpoint */
__le16 s_segment_usage_size; /* Size of a segment usage */
- __u8 s_uuid[16]; /* 128-bit uuid for volume */
- char s_volume_name[80]; /* volume name */
+/*98*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */
+/*A8*/ char s_volume_name[80]; /* volume name */
- __le32 s_c_interval; /* Commit interval of segment */
+/*F8*/ __le32 s_c_interval; /* Commit interval of segment */
__le32 s_c_block_max; /* Threshold of data amount for
the segment construction */
- __u32 s_reserved[192]; /* padding to the end of the block */
+/*100*/ __le64 s_feature_compat; /* Compatible feature set */
+ __le64 s_feature_compat_ro; /* Read-only compatible feature set */
+ __le64 s_feature_incompat; /* Incompatible feature set */
+ __u32 s_reserved[186]; /* padding to the end of the block */
};
/*
@@ -228,6 +231,16 @@ struct nilfs_super_block {
#define NILFS_MINOR_REV 0 /* minor revision */
/*
+ * Feature set definitions
+ *
+ * If there is a bit set in the incompatible feature set that the kernel
+ * doesn't know about, it should refuse to mount the filesystem.
+ */
+#define NILFS_FEATURE_COMPAT_SUPP 0ULL
+#define NILFS_FEATURE_COMPAT_RO_SUPP 0ULL
+#define NILFS_FEATURE_INCOMPAT_SUPP 0ULL
+
+/*
* Bytes count of super_block for CRC-calculation
*/
#define NILFS_SB_BYTES \
@@ -274,6 +287,12 @@ struct nilfs_super_block {
#define NILFS_NAME_LEN 255
/*
+ * Block size limitations
+ */
+#define NILFS_MIN_BLOCK_SIZE 1024
+#define NILFS_MAX_BLOCK_SIZE 65536
+
+/*
* The new version of the directory entry. Since V0 structures are
* stored in intel byte order, and the name_len field could never be
* bigger than 255 chars, it's safe to reclaim the extra byte for the
@@ -313,7 +332,25 @@ enum {
#define NILFS_DIR_ROUND (NILFS_DIR_PAD - 1)
#define NILFS_DIR_REC_LEN(name_len) (((name_len) + 12 + NILFS_DIR_ROUND) & \
~NILFS_DIR_ROUND)
+#define NILFS_MAX_REC_LEN ((1<<16)-1)
+static inline unsigned nilfs_rec_len_from_disk(__le16 dlen)
+{
+ unsigned len = le16_to_cpu(dlen);
+
+ if (len == NILFS_MAX_REC_LEN)
+ return 1 << 16;
+ return len;
+}
+
+static inline __le16 nilfs_rec_len_to_disk(unsigned len)
+{
+ if (len == (1 << 16))
+ return cpu_to_le16(NILFS_MAX_REC_LEN);
+ else if (len > (1 << 16))
+ BUG();
+ return cpu_to_le16(len);
+}
/**
* struct nilfs_finfo - file information