From 67b7fc713827dc84bcee4efd4d241e9bad1a6879 Mon Sep 17 00:00:00 2001 From: John McCutchan Date: Mon, 1 Aug 2005 11:00:45 -0400 Subject: [PATCH] --- yaml --- r: 5549 b: refs/heads/master c: b9c55d29e9fced1eb1b4c252b2efd4b55a0c3c7f h: refs/heads/master i: 5547: a9b4beecc321e6e58bc447ee57001bfe683c7730 v: v3 --- [refs] | 2 +- trunk/fs/inotify.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 1c551155b5a6..6b555c1e4946 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7544953685859875b5ac0260b6b1856066c092d6 +refs/heads/master: b9c55d29e9fced1eb1b4c252b2efd4b55a0c3c7f diff --git a/trunk/fs/inotify.c b/trunk/fs/inotify.c index a8a714e48140..27ebcac5e07f 100644 --- a/trunk/fs/inotify.c +++ b/trunk/fs/inotify.c @@ -90,6 +90,7 @@ struct inotify_device { unsigned int queue_size; /* size of the queue (bytes) */ unsigned int event_count; /* number of pending events */ unsigned int max_events; /* maximum number of events */ + u32 last_wd; /* the last wd allocated */ }; /* @@ -352,7 +353,7 @@ static int inotify_dev_get_wd(struct inotify_device *dev, do { if (unlikely(!idr_pre_get(&dev->idr, GFP_KERNEL))) return -ENOSPC; - ret = idr_get_new(&dev->idr, watch, &watch->wd); + ret = idr_get_new_above(&dev->idr, watch, dev->last_wd, &watch->wd); } while (ret == -EAGAIN); return ret; @@ -401,6 +402,7 @@ static struct inotify_watch *create_watch(struct inotify_device *dev, return ERR_PTR(ret); } + dev->last_wd = ret; watch->mask = mask; atomic_set(&watch->count, 0); INIT_LIST_HEAD(&watch->d_list); @@ -899,6 +901,7 @@ asmlinkage long sys_inotify_init(void) dev->queue_size = 0; dev->max_events = inotify_max_queued_events; dev->user = user; + dev->last_wd = 0; atomic_set(&dev->count, 0); get_inotify_dev(dev);