+#else
+static int osd_ldiskfs_map_inode_pages(struct inode *inode, struct page **page,
+ int pages, unsigned long *blocks,
+ int create)
+{
+ int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits;
+ int rc = 0, i = 0;
+ struct page *fp = NULL;
+ int clen = 0;
+
+ CDEBUG(D_OTHER, "inode %lu: map %d pages from %lu\n",
+ inode->i_ino, pages, (*page)->index);
+
+ /* pages are sorted already. so, we just have to find
+ * contig. space and process them properly */
+ while (i < pages) {
+ long blen, total = 0;
+ handle_t *handle = NULL;
+ struct ldiskfs_map_blocks map = { 0 };
+
+ if (fp == NULL) { /* start new extent */
+ fp = *page++;
+ clen = 1;
+ if (++i != pages)
+ continue;
+ } else if (fp->index + clen == (*page)->index) {
+ /* continue the extent */
+ page++;
+ clen++;
+ if (++i != pages)
+ continue;
+ }
+ /* process found extent */
+ map.m_lblk = fp->index * blocks_per_page;
+ map.m_len = blen = clen * blocks_per_page;
+ if (create) {
+ create = LDISKFS_GET_BLOCKS_CREATE;
+ handle = ldiskfs_journal_current_handle();
+ LASSERT(handle != NULL);
+ }
+cont_map:
+ rc = ldiskfs_map_blocks(handle, inode, &map, create);
+ if (rc >= 0) {
+ int c = 0;
+ for (; total < blen && c < map.m_len; c++, total++) {
+ if (rc == 0) {
+ *(blocks + total) = 0;
+ total++;
+ break;
+ } else {
+ *(blocks + total) = map.m_pblk + c;
+ /* unmap any possible underlying
+ * metadata from the block device
+ * mapping. bug 6998. */
+ if ((map.m_flags & LDISKFS_MAP_NEW) &&
+ create)
+ unmap_underlying_metadata(
+ inode->i_sb->s_bdev,
+ map.m_pblk + c);
+ }
+ }
+ rc = 0;
+ }
+ if (rc == 0 && total < blen) {
+ map.m_lblk = fp->index * blocks_per_page + total;
+ map.m_len = blen - total;
+ goto cont_map;
+ }
+ if (rc != 0)
+ GOTO(cleanup, rc);
+
+ /* look for next extent */
+ fp = NULL;
+ blocks += blocks_per_page * clen;
+ }
+cleanup:
+ return rc;
+}
+#endif /* HAVE_LDISKFS_MAP_BLOCKS */