diff options
Diffstat (limited to 'fs/ocfs2/localalloc.c')
-rw-r--r-- | fs/ocfs2/localalloc.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index 880e4bc827be..e39a3e7146c9 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c | |||
@@ -75,6 +75,34 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb, | |||
75 | static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb, | 75 | static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb, |
76 | struct inode *local_alloc_inode); | 76 | struct inode *local_alloc_inode); |
77 | 77 | ||
78 | void ocfs2_la_set_sizes(struct ocfs2_super *osb, int requested_mb) | ||
79 | { | ||
80 | struct super_block *sb = osb->sb; | ||
81 | unsigned int la_default_mb = OCFS2_DEFAULT_LOCAL_ALLOC_SIZE; | ||
82 | unsigned int la_max_mb; | ||
83 | |||
84 | la_max_mb = ocfs2_clusters_to_megabytes(sb, | ||
85 | ocfs2_local_alloc_size(sb) * 8); | ||
86 | |||
87 | mlog(0, "requested: %dM, max: %uM, default: %uM\n", | ||
88 | requested_mb, la_max_mb, la_default_mb); | ||
89 | |||
90 | if (requested_mb == -1) { | ||
91 | /* No user request - use defaults */ | ||
92 | osb->local_alloc_default_bits = | ||
93 | ocfs2_megabytes_to_clusters(sb, la_default_mb); | ||
94 | } else if (requested_mb > la_max_mb) { | ||
95 | /* Request is too big, we give the maximum available */ | ||
96 | osb->local_alloc_default_bits = | ||
97 | ocfs2_megabytes_to_clusters(sb, la_max_mb); | ||
98 | } else { | ||
99 | osb->local_alloc_default_bits = | ||
100 | ocfs2_megabytes_to_clusters(sb, requested_mb); | ||
101 | } | ||
102 | |||
103 | osb->local_alloc_bits = osb->local_alloc_default_bits; | ||
104 | } | ||
105 | |||
78 | static inline int ocfs2_la_state_enabled(struct ocfs2_super *osb) | 106 | static inline int ocfs2_la_state_enabled(struct ocfs2_super *osb) |
79 | { | 107 | { |
80 | return (osb->local_alloc_state == OCFS2_LA_THROTTLED || | 108 | return (osb->local_alloc_state == OCFS2_LA_THROTTLED || |