direct.c (bc0fb201b34b12e2d16e8cbd5bb078c1db936304) | direct.c (93619e5989173614bef0013b0bb8a3fe3dbd5a95) |
---|---|
1/* 2 * linux/fs/nfs/direct.c 3 * 4 * Copyright (C) 2003 by Chuck Lever <cel@netapp.com> 5 * 6 * High-performance uncached I/O for the Linux NFS client 7 * 8 * There are important applications whose performance or correctness --- 138 unchanged lines hidden (view full) --- 147 struct page *page = pages[i]; 148 if (do_dirty && !PageCompound(page)) 149 set_page_dirty_lock(page); 150 page_cache_release(page); 151 } 152 kfree(pages); 153} 154 | 1/* 2 * linux/fs/nfs/direct.c 3 * 4 * Copyright (C) 2003 by Chuck Lever <cel@netapp.com> 5 * 6 * High-performance uncached I/O for the Linux NFS client 7 * 8 * There are important applications whose performance or correctness --- 138 unchanged lines hidden (view full) --- 147 struct page *page = pages[i]; 148 if (do_dirty && !PageCompound(page)) 149 set_page_dirty_lock(page); 150 page_cache_release(page); 151 } 152 kfree(pages); 153} 154 |
155static inline struct nfs_direct_req *nfs_direct_req_alloc(void) 156{ 157 struct nfs_direct_req *dreq; 158 159 dreq = kmem_cache_alloc(nfs_direct_cachep, SLAB_KERNEL); 160 if (!dreq) 161 return NULL; 162 163 kref_init(&dreq->kref); 164 init_waitqueue_head(&dreq->wait); 165 INIT_LIST_HEAD(&dreq->list); 166 dreq->iocb = NULL; 167 atomic_set(&dreq->count, 0); 168 atomic_set(&dreq->error, 0); 169 170 return dreq; 171} 172 |
|
155static void nfs_direct_req_release(struct kref *kref) 156{ 157 struct nfs_direct_req *dreq = container_of(kref, struct nfs_direct_req, kref); 158 kmem_cache_free(nfs_direct_cachep, dreq); 159} 160 161/* 162 * Collects and returns the final error value/byte-count. --- 26 unchanged lines hidden (view full) --- 189 */ 190static struct nfs_direct_req *nfs_direct_read_alloc(size_t nbytes, size_t rsize) 191{ 192 struct list_head *list; 193 struct nfs_direct_req *dreq; 194 unsigned int reads = 0; 195 unsigned int rpages = (rsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 196 | 173static void nfs_direct_req_release(struct kref *kref) 174{ 175 struct nfs_direct_req *dreq = container_of(kref, struct nfs_direct_req, kref); 176 kmem_cache_free(nfs_direct_cachep, dreq); 177} 178 179/* 180 * Collects and returns the final error value/byte-count. --- 26 unchanged lines hidden (view full) --- 207 */ 208static struct nfs_direct_req *nfs_direct_read_alloc(size_t nbytes, size_t rsize) 209{ 210 struct list_head *list; 211 struct nfs_direct_req *dreq; 212 unsigned int reads = 0; 213 unsigned int rpages = (rsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 214 |
197 dreq = kmem_cache_alloc(nfs_direct_cachep, SLAB_KERNEL); | 215 dreq = nfs_direct_req_alloc(); |
198 if (!dreq) 199 return NULL; 200 | 216 if (!dreq) 217 return NULL; 218 |
201 kref_init(&dreq->kref); 202 init_waitqueue_head(&dreq->wait); 203 INIT_LIST_HEAD(&dreq->list); 204 dreq->iocb = NULL; 205 atomic_set(&dreq->count, 0); 206 atomic_set(&dreq->error, 0); 207 | |
208 list = &dreq->list; 209 for(;;) { 210 struct nfs_read_data *data = nfs_readdata_alloc(rpages); 211 212 if (unlikely(!data)) { 213 while (!list_empty(list)) { 214 data = list_entry(list->next, 215 struct nfs_read_data, pages); --- 458 unchanged lines hidden --- | 219 list = &dreq->list; 220 for(;;) { 221 struct nfs_read_data *data = nfs_readdata_alloc(rpages); 222 223 if (unlikely(!data)) { 224 while (!list_empty(list)) { 225 data = list_entry(list->next, 226 struct nfs_read_data, pages); --- 458 unchanged lines hidden --- |