Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 108546
b: refs/heads/master
c: dab4b4d
h: refs/heads/master
v: v3
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed Aug 13, 2008
1 parent 37e9c06 commit 3112dd1
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 547000da6412c45456ff2ff44a171d01027bd727
refs/heads/master: dab4b4d2f915a65022343012a795f4ae4ae7e83c
10 changes: 9 additions & 1 deletion trunk/fs/ubifs/budget.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,8 @@ int ubifs_budget_space(struct ubifs_info *c, struct ubifs_budget_req *req)
ubifs_assert(req->new_ino_d <= UBIFS_MAX_INO_DATA);
ubifs_assert(req->dirtied_ino <= 4);
ubifs_assert(req->dirtied_ino_d <= UBIFS_MAX_INO_DATA * 4);
ubifs_assert(!(req->new_ino_d & 7));
ubifs_assert(!(req->dirtied_ino_d & 7));

data_growth = calc_data_growth(c, req);
dd_growth = calc_dd_growth(c, req);
Expand Down Expand Up @@ -632,6 +634,8 @@ void ubifs_release_budget(struct ubifs_info *c, struct ubifs_budget_req *req)
ubifs_assert(req->new_ino_d <= UBIFS_MAX_INO_DATA);
ubifs_assert(req->dirtied_ino <= 4);
ubifs_assert(req->dirtied_ino_d <= UBIFS_MAX_INO_DATA * 4);
ubifs_assert(!(req->new_ino_d & 7));
ubifs_assert(!(req->dirtied_ino_d & 7));
if (!req->recalculate) {
ubifs_assert(req->idx_growth >= 0);
ubifs_assert(req->data_growth >= 0);
Expand Down Expand Up @@ -659,7 +663,11 @@ void ubifs_release_budget(struct ubifs_info *c, struct ubifs_budget_req *req)

ubifs_assert(c->budg_idx_growth >= 0);
ubifs_assert(c->budg_data_growth >= 0);
ubifs_assert(c->budg_dd_growth >= 0);
ubifs_assert(c->min_idx_lebs < c->main_lebs);
ubifs_assert(!(c->budg_idx_growth & 7));
ubifs_assert(!(c->budg_data_growth & 7));
ubifs_assert(!(c->budg_dd_growth & 7));
spin_unlock(&c->space_lock);
}

Expand Down Expand Up @@ -701,7 +709,7 @@ void ubifs_release_dirty_inode_budget(struct ubifs_info *c,
struct ubifs_budget_req req;

memset(&req, 0, sizeof(struct ubifs_budget_req));
req.dd_growth = c->inode_budget + ui->data_len;
req.dd_growth = c->inode_budget + ALIGN(ui->data_len, 8);
ubifs_release_budget(c, &req);
}

Expand Down
10 changes: 6 additions & 4 deletions trunk/fs/ubifs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
struct ubifs_inode *dir_ui = ubifs_inode(dir);
int err, sz_change = CALC_DENT_SIZE(dentry->d_name.len);
struct ubifs_budget_req req = { .new_dent = 1, .dirtied_ino = 2,
.dirtied_ino_d = ui->data_len };
.dirtied_ino_d = ALIGN(ui->data_len, 8) };

/*
* Budget request settings: new direntry, changing the target inode,
Expand Down Expand Up @@ -788,7 +788,8 @@ static int ubifs_mknod(struct inode *dir, struct dentry *dentry,
int sz_change = CALC_DENT_SIZE(dentry->d_name.len);
int err, devlen = 0;
struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1,
.new_ino_d = devlen, .dirtied_ino = 1 };
.new_ino_d = ALIGN(devlen, 8),
.dirtied_ino = 1 };

/*
* Budget request settings: new inode, new direntry and changing parent
Expand Down Expand Up @@ -862,7 +863,8 @@ static int ubifs_symlink(struct inode *dir, struct dentry *dentry,
int err, len = strlen(symname);
int sz_change = CALC_DENT_SIZE(dentry->d_name.len);
struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1,
.new_ino_d = len, .dirtied_ino = 1 };
.new_ino_d = ALIGN(len, 8),
.dirtied_ino = 1 };

/*
* Budget request settings: new inode, new direntry and changing parent
Expand Down Expand Up @@ -1011,7 +1013,7 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
struct ubifs_budget_req req = { .new_dent = 1, .mod_dent = 1,
.dirtied_ino = 3 };
struct ubifs_budget_req ino_req = { .dirtied_ino = 1,
.dirtied_ino_d = old_inode_ui->data_len };
.dirtied_ino_d = ALIGN(old_inode_ui->data_len, 8) };
struct timespec time;

/*
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/ubifs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ static int do_setattr(struct ubifs_info *c, struct inode *inode,
loff_t new_size = attr->ia_size;
struct ubifs_inode *ui = ubifs_inode(inode);
struct ubifs_budget_req req = { .dirtied_ino = 1,
.dirtied_ino_d = ui->data_len };
.dirtied_ino_d = ALIGN(ui->data_len, 8) };

err = ubifs_budget_space(c, &req);
if (err)
Expand Down Expand Up @@ -1052,7 +1052,7 @@ static int update_mctime(struct ubifs_info *c, struct inode *inode)
if (mctime_update_needed(inode, &now)) {
int err, release;
struct ubifs_budget_req req = { .dirtied_ino = 1,
.dirtied_ino_d = ui->data_len };
.dirtied_ino_d = ALIGN(ui->data_len, 8) };

err = ubifs_budget_space(c, &req);
if (err)
Expand Down
4 changes: 4 additions & 0 deletions trunk/fs/ubifs/ubifs.h
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,10 @@ struct ubifs_compressor {
* An inode may contain 4KiB of data at max., thus the widths of @new_ino_d
* is 13 bits, and @dirtied_ino_d - 15, because up to 4 inodes may be made
* dirty by the re-name operation.
*
* Note, UBIFS aligns node lengths to 8-bytes boundary, so the requester has to
* make sure the amount of inode data which contribute to @new_ino_d and
* @dirtied_ino_d fields are aligned.
*/
struct ubifs_budget_req {
unsigned int fast:1;
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/ubifs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
struct inode *inode;
struct ubifs_inode *ui, *host_ui = ubifs_inode(host);
struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1,
.new_ino_d = size, .dirtied_ino = 1,
.dirtied_ino_d = host_ui->data_len};
.new_ino_d = size, .dirtied_ino = 1,
.dirtied_ino_d = ALIGN(host_ui->data_len, 8)};

if (host_ui->xattr_cnt >= MAX_XATTRS_PER_INODE)
return -ENOSPC;
Expand Down

0 comments on commit 3112dd1

Please sign in to comment.