[PATCH 11/23] containers: bdi init hooks

Peter Zijlstra
2007-08-03T12:37:24Z

[-- Attachment #1: bdi_init_container.patch --]
[-- Type: text/plain, Size: 1766 bytes --]

split off from the large bdi_init patch because containers are not slated
for mainline any time soon.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
kernel/container.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

Index: linux-2.6/kernel/container.c
===================================================================
--- linux-2.6.orig/kernel/container.c
+++ linux-2.6/kernel/container.c
@@ -567,12 +567,13 @@ static int container_populate_dir(struct
static struct inode_operations container_dir_inode_operations;
static struct file_operations proc_containerstats_operations;

+static struct backing_dev_info container_backing_dev_info = {
+ .capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK,
+};
+
static struct inode *container_new_inode(mode_t mode, struct super_block *sb)
{
struct inode *inode = new_inode(sb);
- static struct backing_dev_info container_backing_dev_info = {
- .capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK,
- };

if (inode) {
inode->i_mode = mode;
@@ -2261,6 +2262,10 @@ int __init container_init(void)
int i;
struct proc_dir_entry *entry;

+ err = bdi_init(&container_backing_dev_info);
+ if (err)
+ return err;
+
for (i = 0; i < CONTAINER_SUBSYS_COUNT; i++) {
struct container_subsys *ss = subsys[i];
if (!ss->early_init)
@@ -2276,6 +2281,9 @@ int __init container_init(void)
entry->proc_fops = &proc_containerstats_operations;

out:
+ if (err)
+ bdi_destroy(&container_backing_dev_info);
+
return err;
}