提交 c8f33b6e 编写于 作者: J Joel Becker 提交者: Mark Fasheh

[PATCH] ocfs2: Alloc at least a page for the DLM hash

The OCFS2 DLM allocates a number of pages for a hash to lookup locks.
There was a bug where a PAGE_SIZE bigger than the hash size (eg, 64K
pages) would result in zero pages allocated.
Signed-off-by: NJoel Becker <joel.becker@oracle.com>
Signed-off-by: NMark Fasheh <mark.fasheh@oracle.com>
上级 03d864c0
...@@ -37,8 +37,12 @@ ...@@ -37,8 +37,12 @@
#define DLM_THREAD_SHUFFLE_INTERVAL 5 // flush everything every 5 passes #define DLM_THREAD_SHUFFLE_INTERVAL 5 // flush everything every 5 passes
#define DLM_THREAD_MS 200 // flush at least every 200 ms #define DLM_THREAD_MS 200 // flush at least every 200 ms
#define DLM_HASH_SIZE (1 << 14) #define DLM_HASH_SIZE_DEFAULT (1 << 14)
#define DLM_HASH_PAGES (DLM_HASH_SIZE / PAGE_SIZE) #if DLM_HASH_SIZE_DEFAULT < PAGE_SIZE
# define DLM_HASH_PAGES 1
#else
# define DLM_HASH_PAGES (DLM_HASH_SIZE_DEFAULT / PAGE_SIZE)
#endif
#define DLM_BUCKETS_PER_PAGE (PAGE_SIZE / sizeof(struct hlist_head)) #define DLM_BUCKETS_PER_PAGE (PAGE_SIZE / sizeof(struct hlist_head))
#define DLM_HASH_BUCKETS (DLM_HASH_PAGES * DLM_BUCKETS_PER_PAGE) #define DLM_HASH_BUCKETS (DLM_HASH_PAGES * DLM_BUCKETS_PER_PAGE)
......
...@@ -67,6 +67,9 @@ static void **dlm_alloc_pagevec(int pages) ...@@ -67,6 +67,9 @@ static void **dlm_alloc_pagevec(int pages)
for (i = 0; i < pages; i++) for (i = 0; i < pages; i++)
if (!(vec[i] = (void *)__get_free_page(GFP_KERNEL))) if (!(vec[i] = (void *)__get_free_page(GFP_KERNEL)))
goto out_free; goto out_free;
mlog(0, "Allocated DLM hash pagevec; %d pages (%lu expected), %Zd buckets per page\n",
pages, DLM_HASH_PAGES, DLM_BUCKETS_PER_PAGE);
return vec; return vec;
out_free: out_free:
dlm_free_pagevec(vec, i); dlm_free_pagevec(vec, i);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册