diff options
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/suballoc.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index 72c198a004df..3be4e73e8b13 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -46,6 +46,9 @@ | |||
46 | 46 | ||
47 | #include "buffer_head_io.h" | 47 | #include "buffer_head_io.h" |
48 | 48 | ||
49 | #define NOT_ALLOC_NEW_GROUP 0 | ||
50 | #define ALLOC_NEW_GROUP 1 | ||
51 | |||
49 | static inline void ocfs2_debug_bg(struct ocfs2_group_desc *bg); | 52 | static inline void ocfs2_debug_bg(struct ocfs2_group_desc *bg); |
50 | static inline void ocfs2_debug_suballoc_inode(struct ocfs2_dinode *fe); | 53 | static inline void ocfs2_debug_suballoc_inode(struct ocfs2_dinode *fe); |
51 | static inline u16 ocfs2_find_victim_chain(struct ocfs2_chain_list *cl); | 54 | static inline u16 ocfs2_find_victim_chain(struct ocfs2_chain_list *cl); |
@@ -391,7 +394,8 @@ bail: | |||
391 | static int ocfs2_reserve_suballoc_bits(struct ocfs2_super *osb, | 394 | static int ocfs2_reserve_suballoc_bits(struct ocfs2_super *osb, |
392 | struct ocfs2_alloc_context *ac, | 395 | struct ocfs2_alloc_context *ac, |
393 | int type, | 396 | int type, |
394 | u32 slot) | 397 | u32 slot, |
398 | int alloc_new_group) | ||
395 | { | 399 | { |
396 | int status; | 400 | int status; |
397 | u32 bits_wanted = ac->ac_bits_wanted; | 401 | u32 bits_wanted = ac->ac_bits_wanted; |
@@ -446,6 +450,14 @@ static int ocfs2_reserve_suballoc_bits(struct ocfs2_super *osb, | |||
446 | goto bail; | 450 | goto bail; |
447 | } | 451 | } |
448 | 452 | ||
453 | if (alloc_new_group != ALLOC_NEW_GROUP) { | ||
454 | mlog(0, "Alloc File %u Full: wanted=%u, free_bits=%u, " | ||
455 | "and we don't alloc a new group for it.\n", | ||
456 | slot, bits_wanted, free_bits); | ||
457 | status = -ENOSPC; | ||
458 | goto bail; | ||
459 | } | ||
460 | |||
449 | status = ocfs2_block_group_alloc(osb, alloc_inode, bh); | 461 | status = ocfs2_block_group_alloc(osb, alloc_inode, bh); |
450 | if (status < 0) { | 462 | if (status < 0) { |
451 | if (status != -ENOSPC) | 463 | if (status != -ENOSPC) |
@@ -490,7 +502,8 @@ int ocfs2_reserve_new_metadata(struct ocfs2_super *osb, | |||
490 | (*ac)->ac_group_search = ocfs2_block_group_search; | 502 | (*ac)->ac_group_search = ocfs2_block_group_search; |
491 | 503 | ||
492 | status = ocfs2_reserve_suballoc_bits(osb, (*ac), | 504 | status = ocfs2_reserve_suballoc_bits(osb, (*ac), |
493 | EXTENT_ALLOC_SYSTEM_INODE, slot); | 505 | EXTENT_ALLOC_SYSTEM_INODE, |
506 | slot, ALLOC_NEW_GROUP); | ||
494 | if (status < 0) { | 507 | if (status < 0) { |
495 | if (status != -ENOSPC) | 508 | if (status != -ENOSPC) |
496 | mlog_errno(status); | 509 | mlog_errno(status); |
@@ -527,7 +540,7 @@ int ocfs2_reserve_new_inode(struct ocfs2_super *osb, | |||
527 | 540 | ||
528 | status = ocfs2_reserve_suballoc_bits(osb, *ac, | 541 | status = ocfs2_reserve_suballoc_bits(osb, *ac, |
529 | INODE_ALLOC_SYSTEM_INODE, | 542 | INODE_ALLOC_SYSTEM_INODE, |
530 | osb->slot_num); | 543 | osb->slot_num, ALLOC_NEW_GROUP); |
531 | if (status < 0) { | 544 | if (status < 0) { |
532 | if (status != -ENOSPC) | 545 | if (status != -ENOSPC) |
533 | mlog_errno(status); | 546 | mlog_errno(status); |
@@ -557,7 +570,8 @@ int ocfs2_reserve_cluster_bitmap_bits(struct ocfs2_super *osb, | |||
557 | 570 | ||
558 | status = ocfs2_reserve_suballoc_bits(osb, ac, | 571 | status = ocfs2_reserve_suballoc_bits(osb, ac, |
559 | GLOBAL_BITMAP_SYSTEM_INODE, | 572 | GLOBAL_BITMAP_SYSTEM_INODE, |
560 | OCFS2_INVALID_SLOT); | 573 | OCFS2_INVALID_SLOT, |
574 | ALLOC_NEW_GROUP); | ||
561 | if (status < 0 && status != -ENOSPC) { | 575 | if (status < 0 && status != -ENOSPC) { |
562 | mlog_errno(status); | 576 | mlog_errno(status); |
563 | goto bail; | 577 | goto bail; |