Whamcloud - gitweb
f88ed87e10b5a6bdd9001a2e73ff97af5b0a6bf1
[fs/lustre-release.git] / lustre / llite / iod.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (c) 2002, 2003 Cluster File Systems, Inc.
5  *
6  *   This file is part of Lustre, http://www.lustre.org.
7  *
8  *   Lustre is free software; you can redistribute it and/or
9  *   modify it under the terms of version 2 of the GNU General Public
10  *   License as published by the Free Software Foundation.
11  *
12  *   Lustre is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with Lustre; if not, write to the Free Software
19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  *
21  *  Copyright (C) 2002, 2003  Cluster File Systems, Inc
22  *
23  *  this started as an implementation of an io daemon that woke regularly
24  *  to force writeback.. the throttling in prepare_write and kupdate's usual
25  *  writeback pressure got rid of our thread, but the file name remains.
26  */
27
28 #include <linux/version.h>
29 #include <linux/config.h>
30 #include <linux/module.h>
31 #include <linux/fs.h>
32 #include <linux/stat.h>
33 #include <linux/sched.h>
34 #include <linux/smp_lock.h>
35 #include <linux/kmod.h>
36 #include <linux/pagemap.h>
37 #include <linux/mm.h>
38 #include <linux/rbtree.h>
39 #include <linux/seq_file.h>
40 #include <linux/time.h>
41
42 /* PG_inactive_clean is shorthand for rmap, we want free_high/low here.. */
43 #ifdef PG_inactive_clean
44 #include <linux/mm_inline.h>
45 #endif
46
47 #define DEBUG_SUBSYSTEM S_LLITE
48 #include <linux/lustre_lite.h>
49
50 #ifndef list_for_each_prev_safe
51 #define list_for_each_prev_safe(pos, n, head) \
52         for (pos = (head)->prev, n = pos->prev; pos != (head); \
53                 pos = n, n = pos->prev )
54 #endif
55
56 extern spinlock_t inode_lock;
57
58 struct ll_writeback_pages {
59         obd_count npgs, max;
60         struct brw_page *pga;
61 };
62
63 /*
64  * check to see if we're racing with truncate and put the page in
65  * the brw_page array.  returns 0 if there is more room and 1
66  * if the array is full.
67  */
68 static int llwp_consume_page(struct ll_writeback_pages *llwp,
69                              struct inode *inode, struct page *page)
70 {
71         obd_off off = ((obd_off)page->index) << PAGE_SHIFT;
72         struct brw_page *pg;
73
74         /* we raced with truncate? */
75         if ( off >= inode->i_size ) {
76                 ll_remove_dirty(inode, page->index, page->index);
77                 unlock_page(page);
78                 return 0;
79         }
80
81         page_cache_get(page);
82         pg = &llwp->pga[llwp->npgs];
83         llwp->npgs++;
84         LASSERT(llwp->npgs <= llwp->max);
85
86         pg->pg = page;
87         pg->off = off;
88         pg->flag = OBD_BRW_CREATE;
89         pg->count = PAGE_CACHE_SIZE;
90
91         /* catch partial writes for files that end mid-page */
92         if (pg->off + pg->count > inode->i_size)
93                 pg->count = inode->i_size & ~PAGE_CACHE_MASK;
94
95         /*
96          * matches ptlrpc_bulk_get assert that trickles down
97          * from a 0 page length going through niobuf and into
98          * the buffer regions being posted
99          */
100         LASSERT(pg->count >= 0);
101
102         CDEBUG(D_CACHE, "brw_page %p: off "LPU64" cnt %d, page %p: ind %ld"
103                         " i_size: %llu\n", pg, pg->off, pg->count, page,
104                         page->index, inode->i_size);
105
106         return llwp->npgs == llwp->max;
107 }
108
109 /*
110  * returns the number of pages that it added to the pgs array
111  *
112  * this duplicates filemap_fdatasync and gives us an opportunity to grab lots
113  * of dirty pages..
114  */
115 static void ll_get_dirty_pages(struct inode *inode,
116                                struct ll_writeback_pages *llwp)
117 {
118         struct address_space *mapping = inode->i_mapping;
119         struct page *page;
120         struct list_head *pos, *n;
121         ENTRY;
122
123         PGCACHE_WRLOCK(mapping);
124
125         list_for_each_prev_safe(pos, n, &mapping->dirty_pages) {
126                 page = list_entry(pos, struct page, list);
127
128                 if (TryLockPage(page))
129                         continue;
130
131                 list_del(&page->list);
132                 list_add(&page->list, &mapping->locked_pages);
133
134                 if ( ! PageDirty(page) ) {
135                         unlock_page(page);
136                         continue;
137                 }
138                 ClearPageDirty(page);
139
140                 if ( llwp_consume_page(llwp, inode, page) != 0)
141                         break;
142         }
143
144         PGCACHE_WRUNLOCK(mapping);
145         EXIT;
146 }
147
148 static void ll_writeback(struct inode *inode, struct ll_writeback_pages *llwp)
149 {
150         int rc, i;
151         struct ptlrpc_request_set *set;
152         ENTRY;
153
154         CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),bytes=%u\n",
155                inode->i_ino, inode->i_generation, inode,
156                ((llwp->npgs-1) << PAGE_SHIFT) + llwp->pga[llwp->npgs-1].count);
157
158         set = ptlrpc_prep_set();
159         if (set == NULL) {
160                 CERROR ("Can't create request set\n");
161                 rc = -ENOMEM;
162         } else {
163                 rc = obd_brw_async(OBD_BRW_WRITE, ll_i2obdconn(inode),
164                                    ll_i2info(inode)->lli_smd, llwp->npgs,
165                                    llwp->pga, set, NULL);
166                 if (rc == 0)
167                         rc = ptlrpc_set_wait (set);
168                 ptlrpc_set_destroy (set);
169         }
170         /*
171          * b=1038, we need to pass _brw errors up so that writeback
172          * doesn't get stuck in recovery leaving processes stuck in
173          * D waiting for pages
174          */
175         if (rc) {
176                 CERROR("error from obd_brw_async: rc = %d\n", rc);
177                 INODE_IO_STAT_ADD(inode, wb_fail, llwp->npgs);
178         } else {
179                 INODE_IO_STAT_ADD(inode, wb_ok, llwp->npgs);
180         }
181
182         for (i = 0 ; i < llwp->npgs ; i++) {
183                 struct page *page = llwp->pga[i].pg;
184
185                 CDEBUG(D_CACHE, "finished page %p at index %lu\n", page,
186                        page->index);
187                 LASSERT(PageLocked(page));
188                 ll_remove_dirty(inode, page->index, page->index);
189                 unlock_page(page);
190                 page_cache_release(page);
191         }
192
193         EXIT;
194 }
195
196 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
197
198 #ifndef PG_inactive_clean
199 #ifdef CONFIG_DISCONTIGMEM
200 #error "sorry, we don't support DISCONTIGMEM yet"
201 #endif
202
203 /*
204  * __alloc_pages marks a zone as needing balancing if an allocation is
205  * performed when the zone has fewer free pages than its 'low' water
206  * mark.  its cleared when try_to_free_pages makes progress.
207  */
208 static int zones_need_balancing(void)
209 {
210         pg_data_t * pgdat;
211         zone_t *zone;
212         int i;
213
214         for ( pgdat = pgdat_list ; pgdat != NULL ; pgdat = pgdat->node_next ) {
215                 for ( i = pgdat->nr_zones-1 ; i >= 0 ; i-- ) {
216                         zone = &pgdat->node_zones[i];
217
218                         if ( zone->need_balance )
219                                 return 1;
220                 }
221         }
222         return 0;
223 }
224 #endif
225 /* 2.4 doesn't give us a way to find out how many pages we have
226  * cached 'cause we're not using buffer_heads.  we are very
227  * conservative here and flush the superblock of all dirty data
228  * when the vm (rmap or stock) thinks that it is running low
229  * and kswapd would have done work.  kupdated isn't good enough
230  * because writers (dbench) can dirty _very quickly_, and we
231  * allocate under writepage..
232  *
233  * 2.5 gets this right, see the {inc,dec}_page_state(nr_dirty, )
234  */
235 static int should_writeback(void)
236 {
237 #ifdef PG_inactive_clean
238         if (free_high(ALL_ZONES) > 0 || free_low(ANY_ZONE) > 0)
239 #else
240         if (zones_need_balancing())
241 #endif
242                 return 1;
243         return 0;
244 }
245
246 static int ll_alloc_brw(struct inode *inode, struct ll_writeback_pages *llwp)
247 {
248         memset(llwp, 0, sizeof(struct ll_writeback_pages));
249
250         llwp->max = inode->i_blksize >> PAGE_CACHE_SHIFT;
251         if (llwp->max == 0) {
252                 CERROR("forcing llwp->max to 1.  blksize: %lu\n",
253                        inode->i_blksize);
254                 llwp->max = 1;
255         }
256         llwp->pga = kmalloc(llwp->max * sizeof(*llwp->pga), GFP_ATOMIC);
257         if (llwp->pga == NULL)
258                 RETURN(-ENOMEM);
259         RETURN(0);
260 }
261
262 int ll_check_dirty(struct super_block *sb)
263 {
264         unsigned long old_flags; /* hack? */
265         int making_progress;
266         struct inode *inode;
267         int rc = 0;
268         ENTRY;
269
270         if (!should_writeback())
271                 return 0;
272
273         old_flags = current->flags;
274         current->flags |= PF_MEMALLOC;
275
276         spin_lock(&inode_lock);
277
278         /*
279          * first we try and write back dirty pages from dirty inodes
280          * until the VM thinkgs we're ok again..
281          */
282         do {
283                 struct ll_writeback_pages llwp;
284                 struct list_head *pos;
285                 inode = NULL;
286                 making_progress = 0;
287
288                 list_for_each_prev(pos, &sb->s_dirty) {
289                         inode = list_entry(pos, struct inode, i_list);
290
291                         if (!(inode->i_state & I_DIRTY_PAGES)) {
292                                 inode = NULL;
293                                 continue;
294                         }
295                         break;
296                 }
297
298                 if (inode == NULL)
299                         break;
300
301                 /* duplicate __sync_one, *sigh* */
302                 list_del(&inode->i_list);
303                 list_add(&inode->i_list, &inode->i_sb->s_locked_inodes);
304                 inode->i_state |= I_LOCK;
305                 inode->i_state &= ~I_DIRTY_PAGES;
306
307                 spin_unlock(&inode_lock);
308
309                 rc = ll_alloc_brw(inode, &llwp);
310                 if (rc != 0)
311                         GOTO(cleanup, rc);
312
313                 do {
314                         llwp.npgs = 0;
315                         ll_get_dirty_pages(inode, &llwp);
316                         if (llwp.npgs) {
317                                 INODE_IO_STAT_ADD(inode, wb_from_pressure,
318                                                   llwp.npgs);
319                                 ll_writeback(inode, &llwp);
320                                 rc += llwp.npgs;
321                                 making_progress = 1;
322                         }
323                 } while (llwp.npgs && should_writeback());
324
325                 spin_lock(&inode_lock);
326
327                 if (!list_empty(&inode->i_mapping->dirty_pages))
328                         inode->i_state |= I_DIRTY_PAGES;
329
330                 inode->i_state &= ~I_LOCK;
331                 /*
332                  * we are sneaky and leave the inode on the dirty list,
333                  * even though it might not still be..
334                  */
335                 if (!(inode->i_state & I_FREEING)) {
336                         list_del(&inode->i_list);
337                         list_add(&inode->i_list, &inode->i_sb->s_dirty);
338                 }
339                 wake_up(&inode->i_wait);
340                 kfree(llwp.pga);
341         } while (making_progress && should_writeback());
342
343         /*
344          * and if that didn't work, we sleep on any data that might
345          * be under writeback..
346          */
347         while (should_writeback()) {
348                 if (list_empty(&sb->s_locked_inodes))
349                         break;
350
351                 inode = list_entry(sb->s_locked_inodes.next, struct inode,
352                                    i_list);
353
354                 atomic_inc(&inode->i_count); /* XXX hack? */
355                 spin_unlock(&inode_lock);
356                 wait_event(inode->i_wait, !(inode->i_state & I_LOCK));
357                 iput(inode);
358                 spin_lock(&inode_lock);
359         }
360
361         spin_unlock(&inode_lock);
362
363 cleanup:
364         current->flags = old_flags;
365
366         RETURN(rc);
367 }
368 #endif /* linux 2.5 */
369
370 int ll_batch_writepage(struct inode *inode, struct page *page)
371 {
372         unsigned long old_flags; /* hack? */
373         struct ll_writeback_pages llwp;
374         int rc = 0;
375         ENTRY;
376
377         old_flags = current->flags;
378         current->flags |= PF_MEMALLOC;
379         rc = ll_alloc_brw(inode, &llwp);
380         if (rc != 0)
381                 GOTO(cleanup, rc);
382
383         if (llwp_consume_page(&llwp, inode, page) == 0)
384                 ll_get_dirty_pages(inode, &llwp);
385
386         if (llwp.npgs) {
387                 INODE_IO_STAT_ADD(inode, wb_from_writepage, llwp.npgs);
388                 ll_writeback(inode, &llwp);
389         }
390
391         kfree(llwp.pga);
392 cleanup:
393         current->flags = old_flags;
394         RETURN(rc);
395 }
396
397 /*
398  * we aggressively track offsets of pages that have been dirtied.  we need this
399  * to make file size decisions around lock acquisition and cancelation.  all
400  * extents include the offsets at their endpoints.
401  */
402 struct offset_extent {
403         rb_node_t       oe_node;
404         unsigned long   oe_start, oe_end;
405 };
406
407 static struct offset_extent *ll_find_oe(rb_root_t *root,
408                                         struct offset_extent *needle)
409 {
410         struct rb_node_s *node = root->rb_node;
411         struct offset_extent *oe;
412         ENTRY;
413
414         CDEBUG(D_INODE, "searching [%lu -> %lu]\n", needle->oe_start,
415                needle->oe_end);
416
417         while (node) {
418                 oe = rb_entry(node, struct offset_extent, oe_node);
419                 if (needle->oe_end < oe->oe_start)
420                         node = node->rb_left;
421                 else if (needle->oe_start > oe->oe_end)
422                         node = node->rb_right;
423                 else {
424                         CDEBUG(D_INODE, "returning [%lu -> %lu]\n",
425                                oe->oe_start, oe->oe_end);
426                         RETURN(oe);
427                 }
428         }
429         RETURN(NULL);
430 }
431
432 /* do the rbtree mechanics to insert a node, callers are responsible
433  * for making sure that this new node doesn't overlap with existing
434  * nodes */
435 static void ll_insert_oe(rb_root_t *root, struct offset_extent *new_oe)
436 {
437         rb_node_t ** p = &root->rb_node;
438         rb_node_t * parent = NULL;
439         struct offset_extent *oe;
440         ENTRY;
441
442         LASSERT(new_oe->oe_start <= new_oe->oe_end);
443
444         while (*p) {
445                 parent = *p;
446                 oe = rb_entry(parent, struct offset_extent, oe_node);
447                 if ( new_oe->oe_end < oe->oe_start )
448                         p = &(*p)->rb_left;
449                 else if ( new_oe->oe_start > oe->oe_end )
450                         p = &(*p)->rb_right;
451                 else
452                         LBUG();
453         }
454         rb_link_node(&new_oe->oe_node, parent, p);
455         rb_insert_color(&new_oe->oe_node, root);
456         EXIT;
457 }
458
459 static inline void lldo_dirty_add(struct inode *inode,
460                                   struct ll_dirty_offsets *lldo,
461                                   long val)
462 {
463         lldo->do_num_dirty += val;
464         INODE_IO_STAT_ADD(inode, dirty_pages, val);
465 }
466
467 void ll_record_dirty(struct inode *inode, unsigned long offset)
468 {
469         struct ll_dirty_offsets *lldo = &ll_i2info(inode)->lli_dirty;
470         struct offset_extent needle, *oe, *new_oe;
471         int rc;
472         ENTRY;
473
474         /* will allocate more intelligently later */
475         OBD_ALLOC(new_oe, sizeof(*new_oe));
476         LASSERT(new_oe); /* will have to do for now :/ */
477
478         spin_lock(&lldo->do_lock);
479
480         /* find neighbours that we might glom on to */
481         needle.oe_start = (offset > 0) ? offset - 1 : offset;
482         needle.oe_end = (offset < ~0) ? offset + 1 : offset;
483         oe = ll_find_oe(&lldo->do_root, &needle);
484         if ( oe == NULL ) {
485                 new_oe->oe_start = offset;
486                 new_oe->oe_end = offset;
487                 ll_insert_oe(&lldo->do_root, new_oe);
488                 lldo_dirty_add(inode, lldo, 1);
489                 new_oe = NULL;
490                 GOTO(out, rc = 1);
491         }
492
493         /* already recorded */
494         if ( offset >= oe->oe_start && offset <= oe->oe_end )
495                 GOTO(out, rc = 2);
496
497         /* ok, need to check for adjacent neighbours */
498         needle.oe_start = offset;
499         needle.oe_end = offset;
500         if (ll_find_oe(&lldo->do_root, &needle))
501                 GOTO(out, rc = 3);
502
503         /* ok, its safe to extend the oe we found */
504         if ( offset == oe->oe_start - 1 )
505                 oe->oe_start--;
506         else if ( offset == oe->oe_end + 1 )
507                 oe->oe_end++;
508         else
509                 LBUG();
510         lldo_dirty_add(inode, lldo, 1);
511
512 out:
513         CDEBUG(D_INODE, "%lu now dirty\n", lldo->do_num_dirty);
514         spin_unlock(&lldo->do_lock);
515         if ( new_oe )
516                 OBD_FREE(new_oe, sizeof(*new_oe));
517         EXIT;
518         return;
519 }
520
521 void ll_remove_dirty(struct inode *inode, unsigned long start,
522                      unsigned long end)
523 {
524         struct ll_dirty_offsets *lldo = &ll_i2info(inode)->lli_dirty;
525         struct offset_extent needle, *oe, *new_oe;
526         ENTRY;
527
528         /* will allocate more intelligently later */
529         OBD_ALLOC(new_oe, sizeof(*new_oe));
530         LASSERT(new_oe); /* will have to do for now :/ */
531
532         needle.oe_start = start;
533         needle.oe_end = end;
534
535         spin_lock(&lldo->do_lock);
536         for ( ; (oe = ll_find_oe(&lldo->do_root, &needle)) ; ) {
537
538                 /* see if we're punching a hole and need to create a node */
539                 if (oe->oe_start < start && oe->oe_end > end) {
540                         new_oe->oe_start = end + 1;
541                         new_oe->oe_end = oe->oe_end;
542                         oe->oe_end = start - 1;
543                         ll_insert_oe(&lldo->do_root, new_oe);
544                         new_oe = NULL;
545                         lldo_dirty_add(inode, lldo, -(end - start + 1));
546                         break;
547                 }
548
549                 /* overlapping edges */
550                 if (oe->oe_start < start && oe->oe_end <= end) {
551                         lldo_dirty_add(inode, lldo, -(oe->oe_end - start + 1));
552                         oe->oe_end = start - 1;
553                         oe = NULL;
554                         continue;
555                 }
556                 if (oe->oe_end > end && oe->oe_start >= start) {
557                         lldo_dirty_add(inode, lldo, -(end - oe->oe_start + 1));
558                         oe->oe_start = end + 1;
559                         oe = NULL;
560                         continue;
561                 }
562
563                 /* an extent entirely within the one we're clearing */
564                 rb_erase(&oe->oe_node, &lldo->do_root);
565                 lldo_dirty_add(inode, lldo, -(oe->oe_end - oe->oe_start + 1));
566                 spin_unlock(&lldo->do_lock);
567                 OBD_FREE(oe, sizeof(*oe));
568                 spin_lock(&lldo->do_lock);
569         }
570         CDEBUG(D_INODE, "%lu now dirty\n", lldo->do_num_dirty);
571         spin_unlock(&lldo->do_lock);
572         if (new_oe)
573                 OBD_FREE(new_oe, sizeof(*new_oe));
574         EXIT;
575 }
576
577 int ll_find_dirty(struct ll_dirty_offsets *lldo, unsigned long *start,
578                   unsigned long *end)
579 {
580         struct offset_extent needle, *oe;
581         int rc = -ENOENT;
582         ENTRY;
583
584         needle.oe_start = *start;
585         needle.oe_end = *end;
586
587         spin_lock(&lldo->do_lock);
588         oe = ll_find_oe(&lldo->do_root, &needle);
589         if (oe) {
590                 *start = oe->oe_start;
591                 *end = oe->oe_end;
592                 rc = 0;
593         }
594         spin_unlock(&lldo->do_lock);
595
596         RETURN(rc);
597 }
598
599 int ll_farthest_dirty(struct ll_dirty_offsets *lldo, unsigned long *farthest)
600 {
601         struct rb_node_s *last, *node;
602         struct offset_extent *oe;
603         int rc = -1;
604         ENTRY;
605
606         spin_lock(&lldo->do_lock);
607         for (node = lldo->do_root.rb_node, last = NULL;
608              node;
609              last = node, node = node->rb_right)
610                 ;
611
612         if (last) {
613                 oe = rb_entry(last, struct offset_extent, oe_node);
614                 *farthest = oe->oe_end;
615                 rc = 0;
616         }
617         spin_unlock(&lldo->do_lock);
618         RETURN(rc);
619 }
620
621 void ll_lldo_init(struct ll_dirty_offsets *lldo)
622 {
623         spin_lock_init(&lldo->do_lock);
624         lldo->do_num_dirty = 0;
625         lldo->do_root.rb_node = NULL;
626 }
627
628 /* seq file export of some page cache tracking stats */
629 static int ll_pgcache_seq_show(struct seq_file *seq, void *v)
630 {
631         struct timeval now;
632         struct ll_sb_info *sbi = seq->private;
633         do_gettimeofday(&now);
634
635         seq_printf(seq, "snapshot_time:            %lu:%lu (secs:usecs)\n",
636                    now.tv_sec, now.tv_usec);
637 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
638         seq_printf(seq, "VM_under_pressure:        %s\n",
639                    should_writeback() ? "yes" : "no");
640 #endif        
641         seq_printf(seq, "dirty_pages:              "LPU64"\n",
642                    sbi->ll_iostats.fis_dirty_pages);
643         seq_printf(seq, "dirty_page_hits:          "LPU64"\n",
644                    sbi->ll_iostats.fis_dirty_hits);
645         seq_printf(seq, "dirty_page_misses:        "LPU64"\n",
646                    sbi->ll_iostats.fis_dirty_misses);
647         seq_printf(seq, "writeback_from_writepage: "LPU64"\n",
648                    sbi->ll_iostats.fis_wb_from_writepage);
649         seq_printf(seq, "writeback_from_pressure:  "LPU64"\n",
650                    sbi->ll_iostats.fis_wb_from_pressure);
651         seq_printf(seq, "writeback_ok_pages:       "LPU64"\n",
652                    sbi->ll_iostats.fis_wb_ok);
653         seq_printf(seq, "writeback_failed_pages:   "LPU64"\n",
654                    sbi->ll_iostats.fis_wb_fail);
655         return 0;
656 }
657
658 static void *ll_pgcache_seq_start(struct seq_file *p, loff_t *pos)
659 {
660         if (*pos == 0)
661                 return (void *)1;
662         return NULL;
663 }
664 static void *ll_pgcache_seq_next(struct seq_file *p, void *v, loff_t *pos)
665 {
666         ++*pos;
667         return NULL;
668 }
669 static void ll_pgcache_seq_stop(struct seq_file *p, void *v)
670 {
671 }
672
673 struct seq_operations ll_pgcache_seq_sops = {
674         .start = ll_pgcache_seq_start,
675         .stop = ll_pgcache_seq_stop,
676         .next = ll_pgcache_seq_next,
677         .show = ll_pgcache_seq_show,
678 };
679
680 static int ll_pgcache_seq_open(struct inode *inode, struct file *file)
681 {
682         struct proc_dir_entry *dp = inode->u.generic_ip;
683         struct seq_file *seq;
684         int rc;
685
686         rc = seq_open(file, &ll_pgcache_seq_sops);
687         if (rc)
688                 return rc;
689         seq = file->private_data;
690         seq->private = dp->data;
691         return 0;
692 }
693
694 struct file_operations ll_pgcache_seq_fops = {
695         .open    = ll_pgcache_seq_open,
696         .read    = seq_read,
697         .llseek  = seq_lseek,
698         .release = seq_release,
699 };