diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-23 01:43:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-23 01:43:01 -0400 |
commit | caebc160ce3f76761cc62ad96ef6d6f30f54e3dd (patch) | |
tree | 6bedd4a62d65a4ba121a0c170d1ca657d922d352 /fs/nilfs2/the_nilfs.c | |
parent | d798f7f080805ad7e15fc37a43d8c6f91edb6dda (diff) | |
parent | 5fc7b14177b1a1c2f2511aed62a4ca870d0332e7 (diff) |
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:
nilfs2: use mark_buffer_dirty to mark btnode or meta data dirty
nilfs2: always set back pointer to host inode in mapping->host
nilfs2: get rid of NILFS_I_NILFS
nilfs2: use list_first_entry
nilfs2: use empty_aops for gc-inodes
nilfs2: implement resize ioctl
nilfs2: add truncation routine of segment usage file
nilfs2: add routine to move secondary super block
nilfs2: add ioctl which limits range of segment to be allocated
nilfs2: zero fill unused portion of super root block
nilfs2: super root size should change depending on inode size
nilfs2: get rid of private page allocator
nilfs2: merge list_del()/list_add_tail() to list_move_tail()
Diffstat (limited to 'fs/nilfs2/the_nilfs.c')
-rw-r--r-- | fs/nilfs2/the_nilfs.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c index d2acd1a651f3..d32714094375 100644 --- a/fs/nilfs2/the_nilfs.c +++ b/fs/nilfs2/the_nilfs.c | |||
@@ -363,6 +363,24 @@ static unsigned long long nilfs_max_size(unsigned int blkbits) | |||
363 | return res; | 363 | return res; |
364 | } | 364 | } |
365 | 365 | ||
366 | /** | ||
367 | * nilfs_nrsvsegs - calculate the number of reserved segments | ||
368 | * @nilfs: nilfs object | ||
369 | * @nsegs: total number of segments | ||
370 | */ | ||
371 | unsigned long nilfs_nrsvsegs(struct the_nilfs *nilfs, unsigned long nsegs) | ||
372 | { | ||
373 | return max_t(unsigned long, NILFS_MIN_NRSVSEGS, | ||
374 | DIV_ROUND_UP(nsegs * nilfs->ns_r_segments_percentage, | ||
375 | 100)); | ||
376 | } | ||
377 | |||
378 | void nilfs_set_nsegments(struct the_nilfs *nilfs, unsigned long nsegs) | ||
379 | { | ||
380 | nilfs->ns_nsegments = nsegs; | ||
381 | nilfs->ns_nrsvsegs = nilfs_nrsvsegs(nilfs, nsegs); | ||
382 | } | ||
383 | |||
366 | static int nilfs_store_disk_layout(struct the_nilfs *nilfs, | 384 | static int nilfs_store_disk_layout(struct the_nilfs *nilfs, |
367 | struct nilfs_super_block *sbp) | 385 | struct nilfs_super_block *sbp) |
368 | { | 386 | { |
@@ -389,13 +407,9 @@ static int nilfs_store_disk_layout(struct the_nilfs *nilfs, | |||
389 | } | 407 | } |
390 | 408 | ||
391 | nilfs->ns_first_data_block = le64_to_cpu(sbp->s_first_data_block); | 409 | nilfs->ns_first_data_block = le64_to_cpu(sbp->s_first_data_block); |
392 | nilfs->ns_nsegments = le64_to_cpu(sbp->s_nsegments); | ||
393 | nilfs->ns_r_segments_percentage = | 410 | nilfs->ns_r_segments_percentage = |
394 | le32_to_cpu(sbp->s_r_segments_percentage); | 411 | le32_to_cpu(sbp->s_r_segments_percentage); |
395 | nilfs->ns_nrsvsegs = | 412 | nilfs_set_nsegments(nilfs, le64_to_cpu(sbp->s_nsegments)); |
396 | max_t(unsigned long, NILFS_MIN_NRSVSEGS, | ||
397 | DIV_ROUND_UP(nilfs->ns_nsegments * | ||
398 | nilfs->ns_r_segments_percentage, 100)); | ||
399 | nilfs->ns_crc_seed = le32_to_cpu(sbp->s_crc_seed); | 413 | nilfs->ns_crc_seed = le32_to_cpu(sbp->s_crc_seed); |
400 | return 0; | 414 | return 0; |
401 | } | 415 | } |