patch-2.3.10 linux/fs/dquot.c
Next file: linux/fs/exec.c
Previous file: linux/fs/devices.c
Back to the patch index
Back to the overall index
- Lines: 71
- Date:
Sat Jul 3 10:42:21 1999
- Orig file:
v2.3.9/linux/fs/dquot.c
- Orig date:
Thu May 13 14:31:27 1999
diff -u --recursive --new-file v2.3.9/linux/fs/dquot.c linux/fs/dquot.c
@@ -577,32 +577,35 @@
static void add_dquot_ref(kdev_t dev, short type)
{
struct super_block *sb = get_super(dev);
- struct file *filp;
+ struct list_head *p;
struct inode *inode;
if (!sb || !sb->dq_op)
return; /* nothing to do */
- for (filp = inuse_filps; filp; filp = filp->f_next) {
+ file_list_lock();
+ for (p = sb->s_files.next; p != &sb->s_files; p = p->next) {
+ struct file *filp = list_entry(p, struct file, f_list);
if (!filp->f_dentry)
continue;
- if (filp->f_dentry->d_sb != sb)
- continue;
inode = filp->f_dentry->d_inode;
if (!inode)
continue;
/* N.B. race problem -- filp could become unused */
if (filp->f_mode & FMODE_WRITE) {
+ file_list_unlock();
sb->dq_op->initialize(inode, type);
inode->i_flags |= S_QUOTA;
+ file_list_lock();
}
}
+ file_list_unlock();
}
static void reset_dquot_ptrs(kdev_t dev, short type)
{
struct super_block *sb = get_super(dev);
- struct file *filp;
+ struct list_head *p;
struct inode *inode;
struct dquot *dquot;
int cnt;
@@ -614,11 +617,11 @@
/* free any quota for unused dentries */
shrink_dcache_sb(sb);
- for (filp = inuse_filps; filp; filp = filp->f_next) {
+ file_list_lock();
+ for (p = sb->s_files.next; p != &sb->s_files; p = p->next) {
+ struct file *filp = list_entry(p, struct file, f_list);
if (!filp->f_dentry)
continue;
- if (filp->f_dentry->d_sb != sb)
- continue;
inode = filp->f_dentry->d_inode;
if (!inode)
continue;
@@ -637,12 +640,14 @@
inode->i_flags &= ~S_QUOTA;
put_it:
if (dquot != NODQUOT) {
+ file_list_unlock();
dqput(dquot);
/* we may have blocked ... */
goto restart;
}
}
}
+ file_list_unlock();
}
static inline void dquot_incr_inodes(struct dquot *dquot, unsigned long number)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)