Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 195725
b: refs/heads/master
c: e3b4a97
h: refs/heads/master
i:
  195723: b69b577
v: v3
  • Loading branch information
Mark Fasheh authored and Joel Becker committed May 6, 2010
1 parent faa01e9 commit 57de15b
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 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: 4fe370afaae49c57619bb0bedb75de7e7c168308
refs/heads/master: e3b4a97dbe9741a3227c3ed857a0632532fcd386
3 changes: 3 additions & 0 deletions trunk/fs/ocfs2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -2977,6 +2977,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
* if we only get one now, that's enough to continue. The rest
* will be claimed after the conversion to extents.
*/
data_ac->ac_resv = &oi->ip_la_data_resv;
ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off, &len);
if (ret) {
mlog_errno(ret);
Expand Down Expand Up @@ -3347,6 +3348,8 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
goto bail;
}

data_ac->ac_resv = &OCFS2_I(dir)->ip_la_data_resv;

credits = ocfs2_calc_extend_credits(sb, el, 1);
} else {
spin_unlock(&OCFS2_I(dir)->ip_lock);
Expand Down
4 changes: 4 additions & 0 deletions trunk/fs/ocfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@ void ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,

OCFS2_I(inode)->ip_last_used_slot = 0;
OCFS2_I(inode)->ip_last_used_group = 0;

if (S_ISDIR(inode->i_mode))
ocfs2_resv_set_type(&OCFS2_I(inode)->ip_la_data_resv,
OCFS2_RESV_FLAG_DIR);
mlog_exit_void();
}

Expand Down
8 changes: 6 additions & 2 deletions trunk/fs/ocfs2/reservations.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,19 @@ DEFINE_SPINLOCK(resv_lock);

#define OCFS2_MIN_RESV_WINDOW_BITS 8
#define OCFS2_MAX_RESV_WINDOW_BITS 1024
#define OCFS2_RESV_DIR_WINDOW_BITS OCFS2_MIN_RESV_WINDOW_BITS

static unsigned int ocfs2_resv_window_bits(struct ocfs2_reservation_map *resmap,
struct ocfs2_alloc_reservation *resv)
{
struct ocfs2_super *osb = resmap->m_osb;
unsigned int bits;

/* 8, 16, 32, 64, 128, 256, 512, 1024 */
bits = 4 << osb->osb_resv_level;
if (!(resv->r_flags & OCFS2_RESV_FLAG_DIR)) {
/* 8, 16, 32, 64, 128, 256, 512, 1024 */
bits = 4 << osb->osb_resv_level;
} else
bits = OCFS2_RESV_DIR_WINDOW_BITS;

return bits;
}
Expand Down
4 changes: 3 additions & 1 deletion trunk/fs/ocfs2/reservations.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ struct ocfs2_alloc_reservation {
#define OCFS2_RESV_FLAG_INUSE 0x01 /* Set when r_node is part of a btree */
#define OCFS2_RESV_FLAG_TMP 0x02 /* Temporary reservation, will be
* destroyed immedately after use */
#define OCFS2_RESV_FLAG_DIR 0x04 /* Reservation is for an unindexed
* directory btree */

struct ocfs2_reservation_map {
struct rb_root m_reservations;
Expand All @@ -61,7 +63,7 @@ struct ocfs2_reservation_map {

void ocfs2_resv_init_once(struct ocfs2_alloc_reservation *resv);

#define OCFS2_RESV_TYPES (OCFS2_RESV_FLAG_TMP)
#define OCFS2_RESV_TYPES (OCFS2_RESV_FLAG_TMP|OCFS2_RESV_FLAG_DIR)
void ocfs2_resv_set_type(struct ocfs2_alloc_reservation *resv,
unsigned int flags);

Expand Down
1 change: 1 addition & 0 deletions trunk/fs/ocfs2/suballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ void ocfs2_free_ac_resource(struct ocfs2_alloc_context *ac)
}
brelse(ac->ac_bh);
ac->ac_bh = NULL;
ac->ac_resv = NULL;
}

void ocfs2_free_alloc_context(struct ocfs2_alloc_context *ac)
Expand Down

0 comments on commit 57de15b

Please sign in to comment.