Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 173157
b: refs/heads/master
c: daf88c8
h: refs/heads/master
i:
  173155: 7f72d61
v: v3
  • Loading branch information
Frederic Weisbecker committed Sep 14, 2009
1 parent 8ddb374 commit c85b281
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a412f9efdd6424bf4bf28c8e8c92060b5e975482
refs/heads/master: daf88c898312a22b5385655bc6e0b064eaa2efba
26 changes: 26 additions & 0 deletions trunk/fs/reiserfs/lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,32 @@ void reiserfs_write_unlock(struct super_block *s)
}
}

/*
* If we already own the lock, just exit and don't increase the depth.
* Useful when we don't want to lock more than once.
*
* We always return the lock_depth we had before calling
* this function.
*/
int reiserfs_write_lock_once(struct super_block *s)
{
struct reiserfs_sb_info *sb_i = REISERFS_SB(s);

if (sb_i->lock_owner != current) {
mutex_lock(&sb_i->lock);
sb_i->lock_owner = current;
return sb_i->lock_depth++;
}

return sb_i->lock_depth;
}

void reiserfs_write_unlock_once(struct super_block *s, int lock_depth)
{
if (lock_depth == -1)
reiserfs_write_unlock(s);
}

/*
* Utility function to force a BUG if it is called without the superblock
* write lock held. caller is the string printed just before calling BUG()
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/reiserfs_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
*/
void reiserfs_write_lock(struct super_block *s);
void reiserfs_write_unlock(struct super_block *s);
int reiserfs_write_lock_once(struct super_block *s);
void reiserfs_write_unlock_once(struct super_block *s, int lock_depth);

struct fid;

Expand Down

0 comments on commit c85b281

Please sign in to comment.