diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-29 23:34:17 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-29 23:34:17 -0400 |
| commit | c15a2434ed4868cad99278ac4d4ae4de9de62e02 (patch) | |
| tree | 9d08692fda903f92f5bd426147a4bf00043a2ad1 /fs/xfs/xfs_ialloc.c | |
| parent | a94a630a4c69430bb4562ab8252104449bba9a67 (diff) | |
| parent | adaa693b845373296631766176ebf0f73a342e10 (diff) | |
Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6
* 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6: (24 commits)
[XFS] Fix build failure after enabling CONFIG_XFS_DEBUG
[XFS] remove dmapi cruft in xfs_file.c
[XFS] remove sendfile leftovers
[XFS] allow enabling CONFIG_XFS_DEBUG
[XFS] Don't initialise new inode generation numbers to zero
[XFS] Fix check for block zero access in xfs_write_iomap_allocate()
[XFS] Don't double count reserved block changes on UP.
[XFS] remove xfs_log_ticket_zone on rmmod
[XFS] fix non-smp xfs build
[XFS] Fix broken HAVE_SPLICE removal commit.
[XFS] kill XFS_ICSB_SB_LOCKED
[XFS] split xfs_icsb_balance_counter
[XFS] Add xfs_icsb_sync_counters_locked for when m_sb_lock already held
[XFS] Cleanup xfs_attr a bit with xfs_name and remove cred
[XFS] kill usesless IHOLD calls in xfs_remove and xfs_rmdir
[XFS] kill parent == child checks in xfs_remove and xfs_rmdir
[XFS] kill usesless IHOLD calls in xfs_rename
[XFS] remove manual lookup from xfs_rename and simplify locking
[XFS] shrink mrlock_t
[XFS] simplify xfs_lookup
...
Diffstat (limited to 'fs/xfs/xfs_ialloc.c')
| -rw-r--r-- | fs/xfs/xfs_ialloc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index a64dfbd565a5..aad8c5da38af 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c | |||
| @@ -147,6 +147,7 @@ xfs_ialloc_ag_alloc( | |||
| 147 | int version; /* inode version number to use */ | 147 | int version; /* inode version number to use */ |
| 148 | int isaligned = 0; /* inode allocation at stripe unit */ | 148 | int isaligned = 0; /* inode allocation at stripe unit */ |
| 149 | /* boundary */ | 149 | /* boundary */ |
| 150 | unsigned int gen; | ||
| 150 | 151 | ||
| 151 | args.tp = tp; | 152 | args.tp = tp; |
| 152 | args.mp = tp->t_mountp; | 153 | args.mp = tp->t_mountp; |
| @@ -290,6 +291,14 @@ xfs_ialloc_ag_alloc( | |||
| 290 | else | 291 | else |
| 291 | version = XFS_DINODE_VERSION_1; | 292 | version = XFS_DINODE_VERSION_1; |
| 292 | 293 | ||
| 294 | /* | ||
| 295 | * Seed the new inode cluster with a random generation number. This | ||
| 296 | * prevents short-term reuse of generation numbers if a chunk is | ||
| 297 | * freed and then immediately reallocated. We use random numbers | ||
| 298 | * rather than a linear progression to prevent the next generation | ||
| 299 | * number from being easily guessable. | ||
| 300 | */ | ||
| 301 | gen = random32(); | ||
| 293 | for (j = 0; j < nbufs; j++) { | 302 | for (j = 0; j < nbufs; j++) { |
| 294 | /* | 303 | /* |
| 295 | * Get the block. | 304 | * Get the block. |
| @@ -309,6 +318,7 @@ xfs_ialloc_ag_alloc( | |||
| 309 | free = XFS_MAKE_IPTR(args.mp, fbuf, i); | 318 | free = XFS_MAKE_IPTR(args.mp, fbuf, i); |
| 310 | free->di_core.di_magic = cpu_to_be16(XFS_DINODE_MAGIC); | 319 | free->di_core.di_magic = cpu_to_be16(XFS_DINODE_MAGIC); |
| 311 | free->di_core.di_version = version; | 320 | free->di_core.di_version = version; |
| 321 | free->di_core.di_gen = cpu_to_be32(gen); | ||
| 312 | free->di_next_unlinked = cpu_to_be32(NULLAGINO); | 322 | free->di_next_unlinked = cpu_to_be32(NULLAGINO); |
| 313 | xfs_ialloc_log_di(tp, fbuf, i, | 323 | xfs_ialloc_log_di(tp, fbuf, i, |
| 314 | XFS_DI_CORE_BITS | XFS_DI_NEXT_UNLINKED); | 324 | XFS_DI_CORE_BITS | XFS_DI_NEXT_UNLINKED); |
