diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-18 13:32:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-18 13:32:00 -0400 |
commit | d756d10e246a01515d07f8161181b8a14afba7cc (patch) | |
tree | de7336f2b4b596881468bf65cb2f2f88cedcde86 /include | |
parent | cdf4a6482dd4c739f8c1132c5a9356912911fec5 (diff) | |
parent | e9f410b1c035b6e63f0b4c3d6cfe4298d6a04492 (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext4: extent macros cleanup
Fix compilation with EXT_DEBUG, also fix leXX_to_cpu conversions.
ext4: remove extra IS_RDONLY() check
ext4: Use is_power_of_2()
Use zero_user_page() in ext4 where possible
ext4: Remove 65000 subdirectory limit
ext4: Expand extra_inodes space per the s_{want,min}_extra_isize fields
ext4: Add nanosecond timestamps
jbd2: Move jbd2-debug file to debugfs
jbd2: Fix CONFIG_JBD_DEBUG ifdef to be CONFIG_JBD2_DEBUG
ext4: Set the journal JBD2_FEATURE_INCOMPAT_64BIT on large devices
ext4: Make extents code sanely handle on-disk corruption
ext4: copy i_flags to inode flags on write
ext4: Enable extents by default
Change on-disk format to support 2^15 uninitialized extents
write support for preallocated blocks
fallocate support in ext4
sys_fallocate() implementation on i386, x86_64 and powerpc
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-i386/unistd.h | 3 | ||||
-rw-r--r-- | include/asm-powerpc/systbl.h | 1 | ||||
-rw-r--r-- | include/asm-powerpc/unistd.h | 3 | ||||
-rw-r--r-- | include/asm-x86_64/unistd.h | 2 | ||||
-rw-r--r-- | include/linux/ext4_fs.h | 104 | ||||
-rw-r--r-- | include/linux/ext4_fs_extents.h | 43 | ||||
-rw-r--r-- | include/linux/ext4_fs_i.h | 5 | ||||
-rw-r--r-- | include/linux/ext4_fs_sb.h | 3 | ||||
-rw-r--r-- | include/linux/falloc.h | 6 | ||||
-rw-r--r-- | include/linux/fs.h | 2 | ||||
-rw-r--r-- | include/linux/jbd2.h | 6 | ||||
-rw-r--r-- | include/linux/syscalls.h | 1 |
12 files changed, 168 insertions, 11 deletions
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index e84ace1ec8bf..9b15545eb9b5 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h | |||
@@ -329,10 +329,11 @@ | |||
329 | #define __NR_signalfd 321 | 329 | #define __NR_signalfd 321 |
330 | #define __NR_timerfd 322 | 330 | #define __NR_timerfd 322 |
331 | #define __NR_eventfd 323 | 331 | #define __NR_eventfd 323 |
332 | #define __NR_fallocate 324 | ||
332 | 333 | ||
333 | #ifdef __KERNEL__ | 334 | #ifdef __KERNEL__ |
334 | 335 | ||
335 | #define NR_syscalls 324 | 336 | #define NR_syscalls 325 |
336 | 337 | ||
337 | #define __ARCH_WANT_IPC_PARSE_VERSION | 338 | #define __ARCH_WANT_IPC_PARSE_VERSION |
338 | #define __ARCH_WANT_OLD_READDIR | 339 | #define __ARCH_WANT_OLD_READDIR |
diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h index 1cc3f9cb6f4e..cc6d87228258 100644 --- a/include/asm-powerpc/systbl.h +++ b/include/asm-powerpc/systbl.h | |||
@@ -308,6 +308,7 @@ COMPAT_SYS_SPU(move_pages) | |||
308 | SYSCALL_SPU(getcpu) | 308 | SYSCALL_SPU(getcpu) |
309 | COMPAT_SYS(epoll_pwait) | 309 | COMPAT_SYS(epoll_pwait) |
310 | COMPAT_SYS_SPU(utimensat) | 310 | COMPAT_SYS_SPU(utimensat) |
311 | COMPAT_SYS(fallocate) | ||
311 | COMPAT_SYS_SPU(signalfd) | 312 | COMPAT_SYS_SPU(signalfd) |
312 | COMPAT_SYS_SPU(timerfd) | 313 | COMPAT_SYS_SPU(timerfd) |
313 | SYSCALL_SPU(eventfd) | 314 | SYSCALL_SPU(eventfd) |
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h index f71c6061f1ec..97d82b6a9406 100644 --- a/include/asm-powerpc/unistd.h +++ b/include/asm-powerpc/unistd.h | |||
@@ -331,10 +331,11 @@ | |||
331 | #define __NR_timerfd 306 | 331 | #define __NR_timerfd 306 |
332 | #define __NR_eventfd 307 | 332 | #define __NR_eventfd 307 |
333 | #define __NR_sync_file_range2 308 | 333 | #define __NR_sync_file_range2 308 |
334 | #define __NR_fallocate 309 | ||
334 | 335 | ||
335 | #ifdef __KERNEL__ | 336 | #ifdef __KERNEL__ |
336 | 337 | ||
337 | #define __NR_syscalls 309 | 338 | #define __NR_syscalls 310 |
338 | 339 | ||
339 | #define __NR__exit __NR_exit | 340 | #define __NR__exit __NR_exit |
340 | #define NR_syscalls __NR_syscalls | 341 | #define NR_syscalls __NR_syscalls |
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h index 8696f8ad401e..fc4e73f5f1fa 100644 --- a/include/asm-x86_64/unistd.h +++ b/include/asm-x86_64/unistd.h | |||
@@ -630,6 +630,8 @@ __SYSCALL(__NR_signalfd, sys_signalfd) | |||
630 | __SYSCALL(__NR_timerfd, sys_timerfd) | 630 | __SYSCALL(__NR_timerfd, sys_timerfd) |
631 | #define __NR_eventfd 284 | 631 | #define __NR_eventfd 284 |
632 | __SYSCALL(__NR_eventfd, sys_eventfd) | 632 | __SYSCALL(__NR_eventfd, sys_eventfd) |
633 | #define __NR_fallocate 285 | ||
634 | __SYSCALL(__NR_fallocate, sys_fallocate) | ||
633 | 635 | ||
634 | #ifndef __NO_STUBS | 636 | #ifndef __NO_STUBS |
635 | #define __ARCH_WANT_OLD_READDIR | 637 | #define __ARCH_WANT_OLD_READDIR |
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h index de1f9f78625a..cdee7aaa57aa 100644 --- a/include/linux/ext4_fs.h +++ b/include/linux/ext4_fs.h | |||
@@ -71,7 +71,7 @@ | |||
71 | /* | 71 | /* |
72 | * Maximal count of links to a file | 72 | * Maximal count of links to a file |
73 | */ | 73 | */ |
74 | #define EXT4_LINK_MAX 32000 | 74 | #define EXT4_LINK_MAX 65000 |
75 | 75 | ||
76 | /* | 76 | /* |
77 | * Macro-instructions used to manage several block sizes | 77 | * Macro-instructions used to manage several block sizes |
@@ -102,6 +102,7 @@ | |||
102 | EXT4_GOOD_OLD_FIRST_INO : \ | 102 | EXT4_GOOD_OLD_FIRST_INO : \ |
103 | (s)->s_first_ino) | 103 | (s)->s_first_ino) |
104 | #endif | 104 | #endif |
105 | #define EXT4_BLOCK_ALIGN(size, blkbits) ALIGN((size), (1 << (blkbits))) | ||
105 | 106 | ||
106 | /* | 107 | /* |
107 | * Macro-instructions used to manage fragments | 108 | * Macro-instructions used to manage fragments |
@@ -201,6 +202,7 @@ struct ext4_group_desc | |||
201 | #define EXT4_STATE_JDATA 0x00000001 /* journaled data exists */ | 202 | #define EXT4_STATE_JDATA 0x00000001 /* journaled data exists */ |
202 | #define EXT4_STATE_NEW 0x00000002 /* inode is newly created */ | 203 | #define EXT4_STATE_NEW 0x00000002 /* inode is newly created */ |
203 | #define EXT4_STATE_XATTR 0x00000004 /* has in-inode xattrs */ | 204 | #define EXT4_STATE_XATTR 0x00000004 /* has in-inode xattrs */ |
205 | #define EXT4_STATE_NO_EXPAND 0x00000008 /* No space for expansion */ | ||
204 | 206 | ||
205 | /* Used to pass group descriptor data when online resize is done */ | 207 | /* Used to pass group descriptor data when online resize is done */ |
206 | struct ext4_new_group_input { | 208 | struct ext4_new_group_input { |
@@ -225,6 +227,11 @@ struct ext4_new_group_data { | |||
225 | __u32 free_blocks_count; | 227 | __u32 free_blocks_count; |
226 | }; | 228 | }; |
227 | 229 | ||
230 | /* | ||
231 | * Following is used by preallocation code to tell get_blocks() that we | ||
232 | * want uninitialzed extents. | ||
233 | */ | ||
234 | #define EXT4_CREATE_UNINITIALIZED_EXT 2 | ||
228 | 235 | ||
229 | /* | 236 | /* |
230 | * ioctl commands | 237 | * ioctl commands |
@@ -237,7 +244,7 @@ struct ext4_new_group_data { | |||
237 | #define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input) | 244 | #define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input) |
238 | #define EXT4_IOC_GETVERSION_OLD FS_IOC_GETVERSION | 245 | #define EXT4_IOC_GETVERSION_OLD FS_IOC_GETVERSION |
239 | #define EXT4_IOC_SETVERSION_OLD FS_IOC_SETVERSION | 246 | #define EXT4_IOC_SETVERSION_OLD FS_IOC_SETVERSION |
240 | #ifdef CONFIG_JBD_DEBUG | 247 | #ifdef CONFIG_JBD2_DEBUG |
241 | #define EXT4_IOC_WAIT_FOR_READONLY _IOR('f', 99, long) | 248 | #define EXT4_IOC_WAIT_FOR_READONLY _IOR('f', 99, long) |
242 | #endif | 249 | #endif |
243 | #define EXT4_IOC_GETRSVSZ _IOR('f', 5, long) | 250 | #define EXT4_IOC_GETRSVSZ _IOR('f', 5, long) |
@@ -253,7 +260,7 @@ struct ext4_new_group_data { | |||
253 | #define EXT4_IOC32_GETRSVSZ _IOR('f', 5, int) | 260 | #define EXT4_IOC32_GETRSVSZ _IOR('f', 5, int) |
254 | #define EXT4_IOC32_SETRSVSZ _IOW('f', 6, int) | 261 | #define EXT4_IOC32_SETRSVSZ _IOW('f', 6, int) |
255 | #define EXT4_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int) | 262 | #define EXT4_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int) |
256 | #ifdef CONFIG_JBD_DEBUG | 263 | #ifdef CONFIG_JBD2_DEBUG |
257 | #define EXT4_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int) | 264 | #define EXT4_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int) |
258 | #endif | 265 | #endif |
259 | #define EXT4_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION | 266 | #define EXT4_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION |
@@ -282,7 +289,7 @@ struct ext4_inode { | |||
282 | __le16 i_uid; /* Low 16 bits of Owner Uid */ | 289 | __le16 i_uid; /* Low 16 bits of Owner Uid */ |
283 | __le32 i_size; /* Size in bytes */ | 290 | __le32 i_size; /* Size in bytes */ |
284 | __le32 i_atime; /* Access time */ | 291 | __le32 i_atime; /* Access time */ |
285 | __le32 i_ctime; /* Creation time */ | 292 | __le32 i_ctime; /* Inode Change time */ |
286 | __le32 i_mtime; /* Modification time */ | 293 | __le32 i_mtime; /* Modification time */ |
287 | __le32 i_dtime; /* Deletion Time */ | 294 | __le32 i_dtime; /* Deletion Time */ |
288 | __le16 i_gid; /* Low 16 bits of Group Id */ | 295 | __le16 i_gid; /* Low 16 bits of Group Id */ |
@@ -331,10 +338,85 @@ struct ext4_inode { | |||
331 | } osd2; /* OS dependent 2 */ | 338 | } osd2; /* OS dependent 2 */ |
332 | __le16 i_extra_isize; | 339 | __le16 i_extra_isize; |
333 | __le16 i_pad1; | 340 | __le16 i_pad1; |
341 | __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */ | ||
342 | __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */ | ||
343 | __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */ | ||
344 | __le32 i_crtime; /* File Creation time */ | ||
345 | __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */ | ||
334 | }; | 346 | }; |
335 | 347 | ||
336 | #define i_size_high i_dir_acl | 348 | #define i_size_high i_dir_acl |
337 | 349 | ||
350 | #define EXT4_EPOCH_BITS 2 | ||
351 | #define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1) | ||
352 | #define EXT4_NSEC_MASK (~0UL << EXT4_EPOCH_BITS) | ||
353 | |||
354 | /* | ||
355 | * Extended fields will fit into an inode if the filesystem was formatted | ||
356 | * with large inodes (-I 256 or larger) and there are not currently any EAs | ||
357 | * consuming all of the available space. For new inodes we always reserve | ||
358 | * enough space for the kernel's known extended fields, but for inodes | ||
359 | * created with an old kernel this might not have been the case. None of | ||
360 | * the extended inode fields is critical for correct filesystem operation. | ||
361 | * This macro checks if a certain field fits in the inode. Note that | ||
362 | * inode-size = GOOD_OLD_INODE_SIZE + i_extra_isize | ||
363 | */ | ||
364 | #define EXT4_FITS_IN_INODE(ext4_inode, einode, field) \ | ||
365 | ((offsetof(typeof(*ext4_inode), field) + \ | ||
366 | sizeof((ext4_inode)->field)) \ | ||
367 | <= (EXT4_GOOD_OLD_INODE_SIZE + \ | ||
368 | (einode)->i_extra_isize)) \ | ||
369 | |||
370 | static inline __le32 ext4_encode_extra_time(struct timespec *time) | ||
371 | { | ||
372 | return cpu_to_le32((sizeof(time->tv_sec) > 4 ? | ||
373 | time->tv_sec >> 32 : 0) | | ||
374 | ((time->tv_nsec << 2) & EXT4_NSEC_MASK)); | ||
375 | } | ||
376 | |||
377 | static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra) | ||
378 | { | ||
379 | if (sizeof(time->tv_sec) > 4) | ||
380 | time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) | ||
381 | << 32; | ||
382 | time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> 2; | ||
383 | } | ||
384 | |||
385 | #define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \ | ||
386 | do { \ | ||
387 | (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \ | ||
388 | if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \ | ||
389 | (raw_inode)->xtime ## _extra = \ | ||
390 | ext4_encode_extra_time(&(inode)->xtime); \ | ||
391 | } while (0) | ||
392 | |||
393 | #define EXT4_EINODE_SET_XTIME(xtime, einode, raw_inode) \ | ||
394 | do { \ | ||
395 | if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \ | ||
396 | (raw_inode)->xtime = cpu_to_le32((einode)->xtime.tv_sec); \ | ||
397 | if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \ | ||
398 | (raw_inode)->xtime ## _extra = \ | ||
399 | ext4_encode_extra_time(&(einode)->xtime); \ | ||
400 | } while (0) | ||
401 | |||
402 | #define EXT4_INODE_GET_XTIME(xtime, inode, raw_inode) \ | ||
403 | do { \ | ||
404 | (inode)->xtime.tv_sec = (signed)le32_to_cpu((raw_inode)->xtime); \ | ||
405 | if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \ | ||
406 | ext4_decode_extra_time(&(inode)->xtime, \ | ||
407 | raw_inode->xtime ## _extra); \ | ||
408 | } while (0) | ||
409 | |||
410 | #define EXT4_EINODE_GET_XTIME(xtime, einode, raw_inode) \ | ||
411 | do { \ | ||
412 | if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \ | ||
413 | (einode)->xtime.tv_sec = \ | ||
414 | (signed)le32_to_cpu((raw_inode)->xtime); \ | ||
415 | if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \ | ||
416 | ext4_decode_extra_time(&(einode)->xtime, \ | ||
417 | raw_inode->xtime ## _extra); \ | ||
418 | } while (0) | ||
419 | |||
338 | #if defined(__KERNEL__) || defined(__linux__) | 420 | #if defined(__KERNEL__) || defined(__linux__) |
339 | #define i_reserved1 osd1.linux1.l_i_reserved1 | 421 | #define i_reserved1 osd1.linux1.l_i_reserved1 |
340 | #define i_frag osd2.linux2.l_i_frag | 422 | #define i_frag osd2.linux2.l_i_frag |
@@ -533,6 +615,13 @@ static inline struct ext4_inode_info *EXT4_I(struct inode *inode) | |||
533 | return container_of(inode, struct ext4_inode_info, vfs_inode); | 615 | return container_of(inode, struct ext4_inode_info, vfs_inode); |
534 | } | 616 | } |
535 | 617 | ||
618 | static inline struct timespec ext4_current_time(struct inode *inode) | ||
619 | { | ||
620 | return (inode->i_sb->s_time_gran < NSEC_PER_SEC) ? | ||
621 | current_fs_time(inode->i_sb) : CURRENT_TIME_SEC; | ||
622 | } | ||
623 | |||
624 | |||
536 | static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) | 625 | static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) |
537 | { | 626 | { |
538 | return ino == EXT4_ROOT_INO || | 627 | return ino == EXT4_ROOT_INO || |
@@ -603,6 +692,8 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) | |||
603 | #define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 | 692 | #define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 |
604 | #define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 | 693 | #define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 |
605 | #define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 | 694 | #define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 |
695 | #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 | ||
696 | #define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 | ||
606 | 697 | ||
607 | #define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001 | 698 | #define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001 |
608 | #define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002 | 699 | #define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002 |
@@ -620,6 +711,8 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) | |||
620 | EXT4_FEATURE_INCOMPAT_64BIT) | 711 | EXT4_FEATURE_INCOMPAT_64BIT) |
621 | #define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \ | 712 | #define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \ |
622 | EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \ | 713 | EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \ |
714 | EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \ | ||
715 | EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \ | ||
623 | EXT4_FEATURE_RO_COMPAT_BTREE_DIR) | 716 | EXT4_FEATURE_RO_COMPAT_BTREE_DIR) |
624 | 717 | ||
625 | /* | 718 | /* |
@@ -862,6 +955,7 @@ extern int ext4_change_inode_journal_flag(struct inode *, int); | |||
862 | extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *); | 955 | extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *); |
863 | extern void ext4_truncate (struct inode *); | 956 | extern void ext4_truncate (struct inode *); |
864 | extern void ext4_set_inode_flags(struct inode *); | 957 | extern void ext4_set_inode_flags(struct inode *); |
958 | extern void ext4_get_inode_flags(struct ext4_inode_info *); | ||
865 | extern void ext4_set_aops(struct inode *inode); | 959 | extern void ext4_set_aops(struct inode *inode); |
866 | extern int ext4_writepage_trans_blocks(struct inode *); | 960 | extern int ext4_writepage_trans_blocks(struct inode *); |
867 | extern int ext4_block_truncate_page(handle_t *handle, struct page *page, | 961 | extern int ext4_block_truncate_page(handle_t *handle, struct page *page, |
@@ -983,6 +1077,8 @@ extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, | |||
983 | extern void ext4_ext_truncate(struct inode *, struct page *); | 1077 | extern void ext4_ext_truncate(struct inode *, struct page *); |
984 | extern void ext4_ext_init(struct super_block *); | 1078 | extern void ext4_ext_init(struct super_block *); |
985 | extern void ext4_ext_release(struct super_block *); | 1079 | extern void ext4_ext_release(struct super_block *); |
1080 | extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, | ||
1081 | loff_t len); | ||
986 | static inline int | 1082 | static inline int |
987 | ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, | 1083 | ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, |
988 | unsigned long max_blocks, struct buffer_head *bh, | 1084 | unsigned long max_blocks, struct buffer_head *bh, |
diff --git a/include/linux/ext4_fs_extents.h b/include/linux/ext4_fs_extents.h index acfe59740b03..81406f3655d4 100644 --- a/include/linux/ext4_fs_extents.h +++ b/include/linux/ext4_fs_extents.h | |||
@@ -141,7 +141,25 @@ typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *, | |||
141 | 141 | ||
142 | #define EXT_MAX_BLOCK 0xffffffff | 142 | #define EXT_MAX_BLOCK 0xffffffff |
143 | 143 | ||
144 | #define EXT_MAX_LEN ((1UL << 15) - 1) | 144 | /* |
145 | * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an | ||
146 | * initialized extent. This is 2^15 and not (2^16 - 1), since we use the | ||
147 | * MSB of ee_len field in the extent datastructure to signify if this | ||
148 | * particular extent is an initialized extent or an uninitialized (i.e. | ||
149 | * preallocated). | ||
150 | * EXT_UNINIT_MAX_LEN is the maximum number of blocks we can have in an | ||
151 | * uninitialized extent. | ||
152 | * If ee_len is <= 0x8000, it is an initialized extent. Otherwise, it is an | ||
153 | * uninitialized one. In other words, if MSB of ee_len is set, it is an | ||
154 | * uninitialized extent with only one special scenario when ee_len = 0x8000. | ||
155 | * In this case we can not have an uninitialized extent of zero length and | ||
156 | * thus we make it as a special case of initialized extent with 0x8000 length. | ||
157 | * This way we get better extent-to-group alignment for initialized extents. | ||
158 | * Hence, the maximum number of blocks we can have in an *initialized* | ||
159 | * extent is 2^15 (32768) and in an *uninitialized* extent is 2^15-1 (32767). | ||
160 | */ | ||
161 | #define EXT_INIT_MAX_LEN (1UL << 15) | ||
162 | #define EXT_UNINIT_MAX_LEN (EXT_INIT_MAX_LEN - 1) | ||
145 | 163 | ||
146 | 164 | ||
147 | #define EXT_FIRST_EXTENT(__hdr__) \ | 165 | #define EXT_FIRST_EXTENT(__hdr__) \ |
@@ -188,8 +206,31 @@ ext4_ext_invalidate_cache(struct inode *inode) | |||
188 | EXT4_I(inode)->i_cached_extent.ec_type = EXT4_EXT_CACHE_NO; | 206 | EXT4_I(inode)->i_cached_extent.ec_type = EXT4_EXT_CACHE_NO; |
189 | } | 207 | } |
190 | 208 | ||
209 | static inline void ext4_ext_mark_uninitialized(struct ext4_extent *ext) | ||
210 | { | ||
211 | /* We can not have an uninitialized extent of zero length! */ | ||
212 | BUG_ON((le16_to_cpu(ext->ee_len) & ~EXT_INIT_MAX_LEN) == 0); | ||
213 | ext->ee_len |= cpu_to_le16(EXT_INIT_MAX_LEN); | ||
214 | } | ||
215 | |||
216 | static inline int ext4_ext_is_uninitialized(struct ext4_extent *ext) | ||
217 | { | ||
218 | /* Extent with ee_len of 0x8000 is treated as an initialized extent */ | ||
219 | return (le16_to_cpu(ext->ee_len) > EXT_INIT_MAX_LEN); | ||
220 | } | ||
221 | |||
222 | static inline int ext4_ext_get_actual_len(struct ext4_extent *ext) | ||
223 | { | ||
224 | return (le16_to_cpu(ext->ee_len) <= EXT_INIT_MAX_LEN ? | ||
225 | le16_to_cpu(ext->ee_len) : | ||
226 | (le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN)); | ||
227 | } | ||
228 | |||
191 | extern int ext4_extent_tree_init(handle_t *, struct inode *); | 229 | extern int ext4_extent_tree_init(handle_t *, struct inode *); |
192 | extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *); | 230 | extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *); |
231 | extern int ext4_ext_try_to_merge(struct inode *inode, | ||
232 | struct ext4_ext_path *path, | ||
233 | struct ext4_extent *); | ||
193 | extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *); | 234 | extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *); |
194 | extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *); | 235 | extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *); |
195 | extern int ext4_ext_walk_space(struct inode *, unsigned long, unsigned long, ext_prepare_callback, void *); | 236 | extern int ext4_ext_walk_space(struct inode *, unsigned long, unsigned long, ext_prepare_callback, void *); |
diff --git a/include/linux/ext4_fs_i.h b/include/linux/ext4_fs_i.h index 9de494406995..1a511e9905aa 100644 --- a/include/linux/ext4_fs_i.h +++ b/include/linux/ext4_fs_i.h | |||
@@ -153,6 +153,11 @@ struct ext4_inode_info { | |||
153 | 153 | ||
154 | unsigned long i_ext_generation; | 154 | unsigned long i_ext_generation; |
155 | struct ext4_ext_cache i_cached_extent; | 155 | struct ext4_ext_cache i_cached_extent; |
156 | /* | ||
157 | * File creation time. Its function is same as that of | ||
158 | * struct timespec i_{a,c,m}time in the generic inode. | ||
159 | */ | ||
160 | struct timespec i_crtime; | ||
156 | }; | 161 | }; |
157 | 162 | ||
158 | #endif /* _LINUX_EXT4_FS_I */ | 163 | #endif /* _LINUX_EXT4_FS_I */ |
diff --git a/include/linux/ext4_fs_sb.h b/include/linux/ext4_fs_sb.h index 2347557a327a..1b2ffee12be9 100644 --- a/include/linux/ext4_fs_sb.h +++ b/include/linux/ext4_fs_sb.h | |||
@@ -73,7 +73,7 @@ struct ext4_sb_info { | |||
73 | struct list_head s_orphan; | 73 | struct list_head s_orphan; |
74 | unsigned long s_commit_interval; | 74 | unsigned long s_commit_interval; |
75 | struct block_device *journal_bdev; | 75 | struct block_device *journal_bdev; |
76 | #ifdef CONFIG_JBD_DEBUG | 76 | #ifdef CONFIG_JBD2_DEBUG |
77 | struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */ | 77 | struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */ |
78 | wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */ | 78 | wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */ |
79 | #endif | 79 | #endif |
@@ -81,6 +81,7 @@ struct ext4_sb_info { | |||
81 | char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */ | 81 | char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */ |
82 | int s_jquota_fmt; /* Format of quota to use */ | 82 | int s_jquota_fmt; /* Format of quota to use */ |
83 | #endif | 83 | #endif |
84 | unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */ | ||
84 | 85 | ||
85 | #ifdef EXTENTS_STATS | 86 | #ifdef EXTENTS_STATS |
86 | /* ext4 extents stats */ | 87 | /* ext4 extents stats */ |
diff --git a/include/linux/falloc.h b/include/linux/falloc.h new file mode 100644 index 000000000000..8e912ab6a072 --- /dev/null +++ b/include/linux/falloc.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _FALLOC_H_ | ||
2 | #define _FALLOC_H_ | ||
3 | |||
4 | #define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */ | ||
5 | |||
6 | #endif /* _FALLOC_H_ */ | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index 98205f680476..0b806c5e32eb 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1147,6 +1147,8 @@ struct inode_operations { | |||
1147 | ssize_t (*listxattr) (struct dentry *, char *, size_t); | 1147 | ssize_t (*listxattr) (struct dentry *, char *, size_t); |
1148 | int (*removexattr) (struct dentry *, const char *); | 1148 | int (*removexattr) (struct dentry *, const char *); |
1149 | void (*truncate_range)(struct inode *, loff_t, loff_t); | 1149 | void (*truncate_range)(struct inode *, loff_t, loff_t); |
1150 | long (*fallocate)(struct inode *inode, int mode, loff_t offset, | ||
1151 | loff_t len); | ||
1150 | }; | 1152 | }; |
1151 | 1153 | ||
1152 | struct seq_file; | 1154 | struct seq_file; |
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 0e0fedd2039a..260d6d76c5f3 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -50,14 +50,14 @@ | |||
50 | */ | 50 | */ |
51 | #define JBD_DEFAULT_MAX_COMMIT_AGE 5 | 51 | #define JBD_DEFAULT_MAX_COMMIT_AGE 5 |
52 | 52 | ||
53 | #ifdef CONFIG_JBD_DEBUG | 53 | #ifdef CONFIG_JBD2_DEBUG |
54 | /* | 54 | /* |
55 | * Define JBD_EXPENSIVE_CHECKING to enable more expensive internal | 55 | * Define JBD_EXPENSIVE_CHECKING to enable more expensive internal |
56 | * consistency checks. By default we don't do this unless | 56 | * consistency checks. By default we don't do this unless |
57 | * CONFIG_JBD_DEBUG is on. | 57 | * CONFIG_JBD2_DEBUG is on. |
58 | */ | 58 | */ |
59 | #define JBD_EXPENSIVE_CHECKING | 59 | #define JBD_EXPENSIVE_CHECKING |
60 | extern int jbd2_journal_enable_debug; | 60 | extern u8 jbd2_journal_enable_debug; |
61 | 61 | ||
62 | #define jbd_debug(n, f, a...) \ | 62 | #define jbd_debug(n, f, a...) \ |
63 | do { \ | 63 | do { \ |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 83d0ec11235e..7a8b1e3322e0 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -610,6 +610,7 @@ asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemas | |||
610 | asmlinkage long sys_timerfd(int ufd, int clockid, int flags, | 610 | asmlinkage long sys_timerfd(int ufd, int clockid, int flags, |
611 | const struct itimerspec __user *utmr); | 611 | const struct itimerspec __user *utmr); |
612 | asmlinkage long sys_eventfd(unsigned int count); | 612 | asmlinkage long sys_eventfd(unsigned int count); |
613 | asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len); | ||
613 | 614 | ||
614 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]); | 615 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]); |
615 | 616 | ||