linux/fs/ceph/file.c
<<
>>
Prefs
   1#include <linux/ceph/ceph_debug.h>
   2
   3#include <linux/module.h>
   4#include <linux/sched.h>
   5#include <linux/slab.h>
   6#include <linux/file.h>
   7#include <linux/mount.h>
   8#include <linux/namei.h>
   9#include <linux/writeback.h>
  10#include <linux/aio.h>
  11
  12#include "super.h"
  13#include "mds_client.h"
  14
  15/*
  16 * Ceph file operations
  17 *
  18 * Implement basic open/close functionality, and implement
  19 * read/write.
  20 *
  21 * We implement three modes of file I/O:
  22 *  - buffered uses the generic_file_aio_{read,write} helpers
  23 *
  24 *  - synchronous is used when there is multi-client read/write
  25 *    sharing, avoids the page cache, and synchronously waits for an
  26 *    ack from the OSD.
  27 *
  28 *  - direct io takes the variant of the sync path that references
  29 *    user pages directly.
  30 *
  31 * fsync() flushes and waits on dirty pages, but just queues metadata
  32 * for writeback: since the MDS can recover size and mtime there is no
  33 * need to wait for MDS acknowledgement.
  34 */
  35
  36
  37/*
  38 * Prepare an open request.  Preallocate ceph_cap to avoid an
  39 * inopportune ENOMEM later.
  40 */
  41static struct ceph_mds_request *
  42prepare_open_request(struct super_block *sb, int flags, int create_mode)
  43{
  44        struct ceph_fs_client *fsc = ceph_sb_to_client(sb);
  45        struct ceph_mds_client *mdsc = fsc->mdsc;
  46        struct ceph_mds_request *req;
  47        int want_auth = USE_ANY_MDS;
  48        int op = (flags & O_CREAT) ? CEPH_MDS_OP_CREATE : CEPH_MDS_OP_OPEN;
  49
  50        if (flags & (O_WRONLY|O_RDWR|O_CREAT|O_TRUNC))
  51                want_auth = USE_AUTH_MDS;
  52
  53        req = ceph_mdsc_create_request(mdsc, op, want_auth);
  54        if (IS_ERR(req))
  55                goto out;
  56        req->r_fmode = ceph_flags_to_mode(flags);
  57        req->r_args.open.flags = cpu_to_le32(flags);
  58        req->r_args.open.mode = cpu_to_le32(create_mode);
  59out:
  60        return req;
  61}
  62
  63/*
  64 * initialize private struct file data.
  65 * if we fail, clean up by dropping fmode reference on the ceph_inode
  66 */
  67static int ceph_init_file(struct inode *inode, struct file *file, int fmode)
  68{
  69        struct ceph_file_info *cf;
  70        int ret = 0;
  71
  72        switch (inode->i_mode & S_IFMT) {
  73        case S_IFREG:
  74        case S_IFDIR:
  75                dout("init_file %p %p 0%o (regular)\n", inode, file,
  76                     inode->i_mode);
  77                cf = kmem_cache_alloc(ceph_file_cachep, GFP_NOFS | __GFP_ZERO);
  78                if (cf == NULL) {
  79                        ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */
  80                        return -ENOMEM;
  81                }
  82                cf->fmode = fmode;
  83                cf->next_offset = 2;
  84                file->private_data = cf;
  85                BUG_ON(inode->i_fop->release != ceph_release);
  86                break;
  87
  88        case S_IFLNK:
  89                dout("init_file %p %p 0%o (symlink)\n", inode, file,
  90                     inode->i_mode);
  91                ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */
  92                break;
  93
  94        default:
  95                dout("init_file %p %p 0%o (special)\n", inode, file,
  96                     inode->i_mode);
  97                /*
  98                 * we need to drop the open ref now, since we don't
  99                 * have .release set to ceph_release.
 100                 */
 101                ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */
 102                BUG_ON(inode->i_fop->release == ceph_release);
 103
 104                /* call the proper open fop */
 105                ret = inode->i_fop->open(inode, file);
 106        }
 107        return ret;
 108}
 109
 110/*
 111 * If we already have the requisite capabilities, we can satisfy
 112 * the open request locally (no need to request new caps from the
 113 * MDS).  We do, however, need to inform the MDS (asynchronously)
 114 * if our wanted caps set expands.
 115 */
 116int ceph_open(struct inode *inode, struct file *file)
 117{
 118        struct ceph_inode_info *ci = ceph_inode(inode);
 119        struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb);
 120        struct ceph_mds_client *mdsc = fsc->mdsc;
 121        struct ceph_mds_request *req;
 122        struct ceph_file_info *cf = file->private_data;
 123        struct inode *parent_inode = NULL;
 124        int err;
 125        int flags, fmode, wanted;
 126
 127        if (cf) {
 128                dout("open file %p is already opened\n", file);
 129                return 0;
 130        }
 131
 132        /* filter out O_CREAT|O_EXCL; vfs did that already.  yuck. */
 133        flags = file->f_flags & ~(O_CREAT|O_EXCL);
 134        if (S_ISDIR(inode->i_mode))
 135                flags = O_DIRECTORY;  /* mds likes to know */
 136
 137        dout("open inode %p ino %llx.%llx file %p flags %d (%d)\n", inode,
 138             ceph_vinop(inode), file, flags, file->f_flags);
 139        fmode = ceph_flags_to_mode(flags);
 140        wanted = ceph_caps_for_mode(fmode);
 141
 142        /* snapped files are read-only */
 143        if (ceph_snap(inode) != CEPH_NOSNAP && (file->f_mode & FMODE_WRITE))
 144                return -EROFS;
 145
 146        /* trivially open snapdir */
 147        if (ceph_snap(inode) == CEPH_SNAPDIR) {
 148                spin_lock(&ci->i_ceph_lock);
 149                __ceph_get_fmode(ci, fmode);
 150                spin_unlock(&ci->i_ceph_lock);
 151                return ceph_init_file(inode, file, fmode);
 152        }
 153
 154        /*
 155         * No need to block if we have caps on the auth MDS (for
 156         * write) or any MDS (for read).  Update wanted set
 157         * asynchronously.
 158         */
 159        spin_lock(&ci->i_ceph_lock);
 160        if (__ceph_is_any_real_caps(ci) &&
 161            (((fmode & CEPH_FILE_MODE_WR) == 0) || ci->i_auth_cap)) {
 162                int mds_wanted = __ceph_caps_mds_wanted(ci);
 163                int issued = __ceph_caps_issued(ci, NULL);
 164
 165                dout("open %p fmode %d want %s issued %s using existing\n",
 166                     inode, fmode, ceph_cap_string(wanted),
 167                     ceph_cap_string(issued));
 168                __ceph_get_fmode(ci, fmode);
 169                spin_unlock(&ci->i_ceph_lock);
 170
 171                /* adjust wanted? */
 172                if ((issued & wanted) != wanted &&
 173                    (mds_wanted & wanted) != wanted &&
 174                    ceph_snap(inode) != CEPH_SNAPDIR)
 175                        ceph_check_caps(ci, 0, NULL);
 176
 177                return ceph_init_file(inode, file, fmode);
 178        } else if (ceph_snap(inode) != CEPH_NOSNAP &&
 179                   (ci->i_snap_caps & wanted) == wanted) {
 180                __ceph_get_fmode(ci, fmode);
 181                spin_unlock(&ci->i_ceph_lock);
 182                return ceph_init_file(inode, file, fmode);
 183        }
 184        spin_unlock(&ci->i_ceph_lock);
 185
 186        dout("open fmode %d wants %s\n", fmode, ceph_cap_string(wanted));
 187        req = prepare_open_request(inode->i_sb, flags, 0);
 188        if (IS_ERR(req)) {
 189                err = PTR_ERR(req);
 190                goto out;
 191        }
 192        req->r_inode = inode;
 193        ihold(inode);
 194        req->r_num_caps = 1;
 195        if (flags & (O_CREAT|O_TRUNC))
 196                parent_inode = ceph_get_dentry_parent_inode(file->f_dentry);
 197        err = ceph_mdsc_do_request(mdsc, parent_inode, req);
 198        iput(parent_inode);
 199        if (!err)
 200                err = ceph_init_file(inode, file, req->r_fmode);
 201        ceph_mdsc_put_request(req);
 202        dout("open result=%d on %llx.%llx\n", err, ceph_vinop(inode));
 203out:
 204        return err;
 205}
 206
 207
 208/*
 209 * Do a lookup + open with a single request.  If we get a non-existent
 210 * file or symlink, return 1 so the VFS can retry.
 211 */
 212int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
 213                     struct file *file, unsigned flags, umode_t mode,
 214                     int *opened)
 215{
 216        struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
 217        struct ceph_mds_client *mdsc = fsc->mdsc;
 218        struct ceph_mds_request *req;
 219        struct dentry *dn;
 220        int err;
 221
 222        dout("atomic_open %p dentry %p '%.*s' %s flags %d mode 0%o\n",
 223             dir, dentry, dentry->d_name.len, dentry->d_name.name,
 224             d_unhashed(dentry) ? "unhashed" : "hashed", flags, mode);
 225
 226        if (dentry->d_name.len > NAME_MAX)
 227                return -ENAMETOOLONG;
 228
 229        err = ceph_init_dentry(dentry);
 230        if (err < 0)
 231                return err;
 232
 233        /* do the open */
 234        req = prepare_open_request(dir->i_sb, flags, mode);
 235        if (IS_ERR(req))
 236                return PTR_ERR(req);
 237        req->r_dentry = dget(dentry);
 238        req->r_num_caps = 2;
 239        if (flags & O_CREAT) {
 240                req->r_dentry_drop = CEPH_CAP_FILE_SHARED;
 241                req->r_dentry_unless = CEPH_CAP_FILE_EXCL;
 242        }
 243        req->r_locked_dir = dir;           /* caller holds dir->i_mutex */
 244        err = ceph_mdsc_do_request(mdsc,
 245                                   (flags & (O_CREAT|O_TRUNC)) ? dir : NULL,
 246                                   req);
 247        if (err)
 248                goto out_err;
 249
 250        err = ceph_handle_snapdir(req, dentry, err);
 251        if (err == 0 && (flags & O_CREAT) && !req->r_reply_info.head->is_dentry)
 252                err = ceph_handle_notrace_create(dir, dentry);
 253
 254        if (d_unhashed(dentry)) {
 255                dn = ceph_finish_lookup(req, dentry, err);
 256                if (IS_ERR(dn))
 257                        err = PTR_ERR(dn);
 258        } else {
 259                /* we were given a hashed negative dentry */
 260                dn = NULL;
 261        }
 262        if (err)
 263                goto out_err;
 264        if (dn || dentry->d_inode == NULL || S_ISLNK(dentry->d_inode->i_mode)) {
 265                /* make vfs retry on splice, ENOENT, or symlink */
 266                dout("atomic_open finish_no_open on dn %p\n", dn);
 267                err = finish_no_open(file, dn);
 268        } else {
 269                dout("atomic_open finish_open on dn %p\n", dn);
 270                if (req->r_op == CEPH_MDS_OP_CREATE && req->r_reply_info.has_create_ino) {
 271                        *opened |= FILE_CREATED;
 272                }
 273                err = finish_open(file, dentry, ceph_open, opened);
 274        }
 275
 276out_err:
 277        ceph_mdsc_put_request(req);
 278        dout("atomic_open result=%d\n", err);
 279        return err;
 280}
 281
 282int ceph_release(struct inode *inode, struct file *file)
 283{
 284        struct ceph_inode_info *ci = ceph_inode(inode);
 285        struct ceph_file_info *cf = file->private_data;
 286
 287        dout("release inode %p file %p\n", inode, file);
 288        ceph_put_fmode(ci, cf->fmode);
 289        if (cf->last_readdir)
 290                ceph_mdsc_put_request(cf->last_readdir);
 291        kfree(cf->last_name);
 292        kfree(cf->dir_info);
 293        dput(cf->dentry);
 294        kmem_cache_free(ceph_file_cachep, cf);
 295
 296        /* wake up anyone waiting for caps on this inode */
 297        wake_up_all(&ci->i_cap_wq);
 298        return 0;
 299}
 300
 301/*
 302 * Read a range of bytes striped over one or more objects.  Iterate over
 303 * objects we stripe over.  (That's not atomic, but good enough for now.)
 304 *
 305 * If we get a short result from the OSD, check against i_size; we need to
 306 * only return a short read to the caller if we hit EOF.
 307 */
 308static int striped_read(struct inode *inode,
 309                        u64 off, u64 len,
 310                        struct page **pages, int num_pages,
 311                        int *checkeof, bool o_direct,
 312                        unsigned long buf_align)
 313{
 314        struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
 315        struct ceph_inode_info *ci = ceph_inode(inode);
 316        u64 pos, this_len;
 317        int io_align, page_align;
 318        int left, pages_left;
 319        int read;
 320        struct page **page_pos;
 321        int ret;
 322        bool hit_stripe, was_short;
 323
 324        /*
 325         * we may need to do multiple reads.  not atomic, unfortunately.
 326         */
 327        pos = off;
 328        left = len;
 329        page_pos = pages;
 330        pages_left = num_pages;
 331        read = 0;
 332        io_align = off & ~PAGE_MASK;
 333
 334more:
 335        if (o_direct)
 336                page_align = (pos - io_align + buf_align) & ~PAGE_MASK;
 337        else
 338                page_align = pos & ~PAGE_MASK;
 339        this_len = left;
 340        ret = ceph_osdc_readpages(&fsc->client->osdc, ceph_vino(inode),
 341                                  &ci->i_layout, pos, &this_len,
 342                                  ci->i_truncate_seq,
 343                                  ci->i_truncate_size,
 344                                  page_pos, pages_left, page_align);
 345        if (ret == -ENOENT)
 346                ret = 0;
 347        hit_stripe = this_len < left;
 348        was_short = ret >= 0 && ret < this_len;
 349        dout("striped_read %llu~%u (ass=pos, left, read = 0;
ref="fs/ceph/file.c#L344" id="L250" c3ass="line" name="L250"> 350ret < ref="+code=pages_ripe" class="sref">hit_stripe = "unhash HITSTRIPE : "hashed, was_short = "unhash SHORT : "hashed,  351 352ret >= 0 &a 0 href="fs/ceph/file.c#L271" i3="L253" c3ass="line" name="L253"> 353ceph_odi" clas (page_align = ret >=) 0 &aa href="+code=NAME_MASKENOENTASK 354 355read = 0;
pos - off & href="fs/ceph/file.c#L271" i3="L346" class="line" name="L256"> 356dout("stripe zero gapllu~% mullu~%t;, off & ref="+code=buf_allaass="sref">read = 0;
ref="+code=this_llass="sref">pos -  357;_vector_of bys="sref">ceph_vino;_vector_of bya href="+code=inode"lign" class="sref">page_align = read = 0;
ref="fs/ceph/file.c#L344" id="L348" class="line" name="L258"> 358pos - off &href="+code=io_alilaass="sref">read = 0;
ref="+code=this_llclass="sref">pages;
 359 360pos - ret >=ref="fs/ceph/file.c#L345" id="L261" c3ass="line" name="L261"> 361read = 0;
pos - off &ref="fs/ceph/file.c#L345" id="L252" c3ass="line" name="L262"> 362left = ret >=ref="fs/ceph/file.c#L345" id="L253" c3ass="line" name="L263"> 363page_pos = ceph_odi" clas ( 364pages_left = ceph_odi" clas ( 365 366/* wake uF. =?pan>
 367left = hit_stripe =  368more:
 369 370 371was_short =  372/* do the idy nebouncytesf eof?pan>
 373pos - left = inode),
i_truncaa>,
 374checkeof,  375 376/* wake uzero trailr castripe(insidee; we n)pan>
 377left = pos & ~ href="+code=this_l class="sref">inode),
i_truncaa>,
 378pos - left = inode),
i_truncaa>,
 379left = inode),
i_truncaa>,
pos -  380 381dout("stripezero tail \n", left =  382;_vector_of bys="sref">ceph_vino;_vector_of bya href="+code=inode"lign" class="sref">page_align = read = 0;
ref="+code=this_lclass="sref">left,  383pages;
 384read = 0;
<+ref="+code=ret" cclass="sref">left;
 385 386 387 388ret >= 0 &a= href="fs/ceph/file.c#L231" i3="L289" c3ass="line" name="L289"> 389ret = read;
 390dout("striped_read %l a shos \n", ret >=)ref="fs/ceph/file.c#L320" id="L281" c3ass="line" name="L291"> 391ret >=ref="fs/ceph/file.c#L345" id="L292" c3ass="line" name="L292"> 392 393 394 *
 395 * If we Comple/spa synchronousto theandy rite methoot atD/a>)
the OS__usan>
 396 * only rbuffer mulosdymlin)
pa mulusan /a>;
e(if O_DIRECT)n>
 397 */
 398 * If we getllero thelasssts we seboundary, justltiple reads.  not >
 399 */
 400,
_ss="sref">ret,
_s     f="+code=err" cinostripeinofile *file)
file
 href="+code=file" class="sref">privata>;
 401len,
ret
 href="+code=file" plass="sref">off, checkeof,  402 403inode *inode,
ceph_iclas" clasa href="+code=inode"class="sref">file);
 404page **pages, int ref="fs/ceph/file.c#L288" i4=5L304" c4ass="line" name="L295"> 405u64 off, off,  406num_pages,
ret >=ref="fs/ceph/file.c#L345" i4="L307" c4ass="line" name="L307"> 407 408dout("atomicsync clasis i#L30p file &lu~%u (ass=<\n", file)
off, len,
 409file);
flags & flags"unhashT"DIRECT : "hashed,  410 411file);
flags & flags 412num_pages,
ceph_haalc,
_fosspan (ed long privata>;
len,
 413pages, int href="+code=ceph_osdc_rgett)
;_vectors="sref">stripeino)
;_vectora href="+code=inode"class="sref">privata>;
num_pages,
file 414 415num_pages,
ceph_haalc,
_fosspan f="+code=off" class="sref">off, len,
 416pages, int href="+code=ceph_osdc_ralloc;_vectors="sref">stripeino;_vectorspan f="+code=off" cges" class="sref">num_pages,
num_paGFP_NOFS 417 418IS_ERR(pages;
 419PTR_ERR(pages;
 420 421 *
 422 * Readdddddddd* flushe wa /a>; , /a>;
ei inode of by. inode>
 423 * objedddddddd* willvfs reconcurr* o normaleandysync io slow,>
 424 * 425         * we mayi isnce >
 426         */
 427ret = file);m/a>)rite_and_g foa href="+code=dn" cl class="sref">inode),
inode 428ret >= 0l&a 0 ef="fs/ceph/file.c#L345" i4="L319" c4ass="line" name="L329"> 429inode 430 431ret = striped_read(structf="+code=dn" cl class="sref">inode),
off, len,
pages, int ref="+code=this_lges" class="sref">num_pages,
checkeof,  432file);
flags & flags 433privata>;
PAGE_MASK;
 434 435ret >= 0 && file);
flags & flags 436ret = file;_vector_to_usana href="+code=dn" cllclass="sref">pages;
privata>;
off, ret >=)ref="fs/ceph/file.c#L320" i4="L337" c4ass="line" name="L337"> 437ret >= 0 &a= href="fs/ceph/file.c#L231" i4="L338" c4ass="line" name="L338"> 438off, off & ref="+code=buf_allass="sref">ret >=ref="fs/ceph/file.c#L320" i4="L319" c4ass="line" name="L339"> 439 440inode 441file);
flags & flags 442stripeino;_vectora href="+code=dn" cllclass="sref">pages;
num_pages,
file 443 444stripeino;_vectora href="+code=dn" cllclass="sref">pages;
num_pages,
 445dout("atomicsync clasi from t\n", ret >=)ref="fs/ceph/file.c#L320" i4="L346" c4ass="line" name="L346"> 446ret >=ref="fs/ceph/file.c#L345" i4="L347" c4ass="line" name="L347"> 447 448 449 */
 450 * If we Write t"> i to /a>(
 451/*(
 452 * Read amessenger mulsenhe caits tarshorosd)rate aisa if whet i_s whe >
 453 * objectwe not vs.  ceivenge oesponseamessa>; indicaor callero /a>(
 454 * aisaset)ymlinwhe ia t( 455 * If we isa omple/sd early (andyed uccessfully) duee caa time>(< on>
 456 * only rinterrupt >
 457 */
 458 * If we Tode *slusad hit EOt( i to ply>
 459 */
 460 * If wen>
 461stripeinoceph_mdsc_posdst" clas     ef="+code=file" rass="sref">i_trunr,
bool stripeed afespanref="fs/ceph/file.c#L335" i4="L252" c4ass="line" name="L262"> 462 463ceph_inode_info *ci = ceph_inode(i_trunr,
ceph_ir_/a>);
 464 465dout("atomic\n&quop file &ti;llu~%<\n&quo afet;, douti_trunr,
i_trunr,
ceph_ir_ti; 466stripeed afespanhn class="string">"unhashun : "hashed,  467stripeed afespanrhref="fs/ceph/file.c#L269" i4="L268" c4ass="line" name="L268"> 468codss="sref">ceph_osdc_rgettcodsa href="+code=inode"ass="sref">ci = PTR_ERCEPH_CAP_FILE_Ws
 469stripedpin_locka hrea href="+code=ci" class="sref">ci->stripeuted afe_lock
 470lenist_add_taila hrea href="+code=ci" clrass="sref">i_trunr,
ceph_ir_ed afe_item 471ci->ceph_outed afe_)rites
 472stripedpin_unlocka hrea href="+code=ci" class="sref">ci->stripeuted afe_lock
 473 474stripedpin_locka hrea href="+code=ci" class="sref">ci->stripeuted afe_lock
 475fileist_del_/afoa hrea href="+code=ci" clrass="sref">i_trunr,
ceph_ir_ed afe_item 476stripedpin_unlocka hrea href="+code=ci" class="sref">ci->stripeuted afe_lock
 477ceph_osdc_rquescodsa href="+code=inode"ass="sref">ci = PTR_ERCEPH_CAP_FILE_Ws
 478 479 480 481/*
 482 * Read aSynchronoust)rite,  ;
e(if>
 483 * objectO_DIRECT)n>
 484 *
 485 * If we Ify rite lasssts we seboundary, justltiple reads.)rites.  (Flina>
 486 * only rcora>)
t, unfot)rite, we lhould e.g. ts re rite locksis iall>
 487 */
 488 * If wen>
 489,
_ss="sref">ret,
_s     f="+code=err" cinostripeinofile *file)
file
 href="+code=file" class="sref">privata>;
 490,
_ss="sref">ret,
_s     f="+code=err" cclass="sref">left, ret
 hrf="+code=file" plss="sref">pos, ret
 href="+code=file" pplss="sref">pos> -  491 492inode *inode,
ceph_iclas" clasa href="+code=inode"class="sref">file);
 493ceph_inode_info *ci = ceph_inode(inode),
 494clientfsc->clientinode),
 495clientaontexsfsc 496ceph_vino(ceph_va>( 497ceph_mdsc_posdst" clas     ef="+code=file" rass="sref">i_trunr,
 498num_pages 499page **pages, int ref="fs/ceph/file.c#L288" i5="L300" c5ass="line" name="L300"> 500num_pages,
 501u64 len,
 502len 503flags &ref="fs/ceph/file.c#L347" i5=4L303" c5ass="line" name="L294"> 504ceph_osf 505page_align = io_align +  506buf_align) &ref="fs/ceph/file.c#L347" i5=7L303" c5ass="line" name="L297"> 507ret >=ref="fs/ceph/file.c#L345" i5="L308" c5ass="line" name="L308"> 508fscfscPTR_ERCURRENT_TIMEgt;=ref="fs/ceph/file.c#L345" i5=9L308" c5ass="line" name="L299"> 509bool num_paown" clasfile 510 511clientceph_iclas" clasa href="+code=inode"class="sref">file);
PTR_ERCEPH_NOSNAP  512num_pa"ROFSgt;=ref="fs/ceph/file.c#L345" i5="L303" c5ass="line" name="L313"> 513 514dout("atomicsync  rite s i#L30p file &lu~%du (ass=<\n", file)
pos,  515left, file);
flags & flags"unhashT"DIRECT : "hashed,  516 517ret = ceph_v#L32m/a>)rite_and_g fo_of bya href="+code=inode" class="sref">inode),
inodepos, pos - left =  518ret >= 0l&a 0 ef="fs/ceph/file.c#L345" i5="L319" c5ass="line" name="L319"> 519ret >=ref="fs/ceph/file.c#L345" i5="L320" c5ass="line" name="L320"> 520 521ret = ceph_vinv/a>dats" clas" clas2_of bya href="+code=inode" class="sref">inode),
inode 522pos - ENOENTASK 523pos - left = ENOENTASK 524ret >= 0l&a 0 ef="fs/ceph/file.c#L345" i5="L315" c5ass="line" name="L325"> 525dout("atomicinv/a>dats" clas" clas2_of bye , ret >=)ref="fs/ceph/file.c#L320" i5="L326" c5ass="line" name="L326"> 526 527flags &href="+code=ceph_iCEPH_OSD_FLAG_ORDERSNAPs="sref">PTR_ERCEPH_OSD_FLAG_ORDERSNAPamp;h|ef="fs/ceph/file.c#L345" i5="L308" c5ass="line" name="L328"> 528PTR_ERCEPH_OSD_FLAG_ONDISKamp;h|ef="fs/ceph/file.c#L345" i5="L319" c5ass="line" name="L329"> 529PTR_ERCEPH_OSD_FLAG_WRITEgt;=ref="fs/ceph/file.c#L345" i5="L330" c5ass="line" name="L330"> 530file);
flags & flagsflags 531flags &h|ref="+code=ceph_iCEPH_OSD_FLAG_ACKs="sref">PTR_ERCEPH_OSD_FLAG_ACKgt;=ref="fs/ceph/file.c#L345" i5="L312" c5ass="line" name="L332"> 532 533num_pages/* wake uAlso include a  not startsync not  t"> and.wen>
 534 535/*
 536         */
 537 */
 538 * If w  */
 539more:
 540io_align + pos - PAGE_MASK;
 541buf_align) &hre(ed long privata>;
PAGE_MASK;
 542len,
left;
 543 544fscci->ceph_iutsn/a>realmgt;client,d>aontexs 545ceph_va>(ceph_vino(inode),
 546i_trunr,
ceph_mdsc_posdc_newst" clasa hrea href="+code=ci" clcass="sref">fsc->client< clasa hra href="+code=i_layoosdcs="sref">num_paosdcci->dout 547ceph_va>(pos, len,
num_pages 548PTR_ERCEPH_OSD_OP_WRITEflags &ref="+code=page_asn/ass="sref">fsc 549ci->i_trunuttruncats"sasamp;ref="+code=page_aass="sref">ci->i_truncatruncats"slasgt;=ref="fs/ceph/file.c#L301" i5="L250" c5ass="line" name="L250"> 550file 551IS_ERR(i_trunr,
 552PTR_ERR(i_trunr,
 553 554/* wake u rite he OSbeginnr caof first /a>;,  ) /* wpan>
 555page_align = file);
flags & flagsbuf_align) &h:ef="+code=this_lgn" class="sref">io_align +  556num_pages,
ceph_haalc,
_fosspan f="+code=off" clign" class="sref">page_align = len,
 557file);
flags & flags 558pages, int href="+code=ceph_osdc_rgett)
;_vectors="sref">stripeino)
;_vectora href="+code=inode"class="sref">privata>;
num_pages,
file 559IS_ERR(pages;
 560ret = PTR_ERR(pages;
 561dout 562 563 564/*
 565         * we mmmmmmmmm* throw >(<  wa /a>; , /a>;
ei inode of by. node>
 566         */
 567 */
 568ceph_vtruncats" clas" clas_of bya href="+code=inode" class="sref">inode),
inodepos,  569pos - len,
PTR_ERASK 570 571pages, int href="+code=ceph_osdc_ralloc;_vectors="sref">stripeino;_vectorspan f="+code=off" cges" class="sref">num_pages,
num_paGFP_NOFS 572IS_ERR(pages;
 573ret = PTR_ERR(pages;
 574dout 575 576ret = stripeino;_vectora href="+code=dn" cllclass="sref">pages;
privata>;
pos, len,
 577ret >= 0l&a 0 href="fs/ceph/file.c#L269" i5="L268" c5ass="line" name="L278"> 578stripeino;_vectora href="+code=dn" cllclass="sref">pages;
num_pages,
 579dout 580 581 582file);
flags & flagsret >= 0l&a="L253" c5L253" c4ass="line" name=5me="L.c#L300">"unhashun : "unhashunS_ERR
 484i_trunr,
 whe calunr,
 whe calde=ceph_osdc_rcopystripeino 485i_trunr,
ceph_ir_/a>);
),
 486iref">num_paown" clas 487 488 489   ef="_op_extshu    e+cod">num_paown" clasnum_=dn" cllass="sref">i_trunr,
pages, int ref="+code=this_lges" class="sen,
pag">page_align =  490i>fileofef">num_paown" clas 491 492"unhashun 493ceph_mdsc_posdst" clas     a builref">ceph=dn" cllass="sref">i_trunr,
pos, l>fscceph_va>(l>fsc/asn/asgt;=ref="fs/eph/fe=ci" clclss="sref">l>fsc 494 495ef">ceph_mdsc_posdst" clas     a   t">ef">ceph=dn" =ci" clcass="sref">fsc->client< clasa hra href="+code=i_layoosdcs="sref">num_paosdci_trunr,
p>file 496 497ceph_mdsc_posdst" clas     a ref="+">ceph=dn" =ci" clcass="sref">fsc->client< clasa hra href="+code=i_layoosdcs="sref">num_paosdci_trunr,
 498 499file);
flags & flags 500stripeino;_vectora href="+code=dn" cllclass="sref">pages;
num_pages,
>file 501file);
flags &  492;_vectors="sref">stripeino;_vectora href="+code=dn" cllclass="sref">pages;
num_pages,
 503 504dout 505ceph_mdsc_posdst" clas     a ora +">ceph=dn" cllass="sref">i_trunr,
 496ret >= 0l&a="L253" c5L26="line" n6me="L297"> 507le,
 508lenle,
 499le,
 510;
le,
 511 512dmore:
 513 514len 515os> - pos -  516os - i>inode),
 517ceph_osfi_tr=dn" cllass="sref">i>inode),
pos,  518ceph_osf 519ceph_osfceph=dn" cllass="sref">ilas  f byauncatruncats"sllas  f bya=dn" cllass="sref">i>inode),
 520iNULLe),
 521 522ret >=ref="fs/ceph/file.c#L345" i5="L320" c5as6="line" n6me="L323"> 523 524 525         * we mmmmmfs/ceph/file.c#L325" i5="L345" c5as6="line" n6me="L326"> 526 * only rcora>)
t, unfWrap generic_45" _aioref=h with /ref"s for cep bithref=the ="fs/s/ceph/file.c#L326" i5="L267" c5as6="line" n6me="L327"> 527 */ 528 * If wen>
 529 *
 530 * If wen>
 531/*
 532,
_ss="sref">ret,
_s     f="+code=err" cinoovcovc<=err"es" class="sref"iov/atimespesa hre>ove=thiile.c#L300" i4="L349" c4as6="line" n6me="L333"> 533pos,  534 535file *filc/asn/asgt;=ref=filcfs/cephs"lign" class="iocbuncatruncats"sliocb=err=fmode" _ class="sreki_filc/asn/asgt;=ref=ki_filceph/file.c#L345" i5="L320" c5as6="line" n6me="L336"> 53645" _ceph_inode_info *fi/asn/asgt;=ref=fifs/cephs"lign" class="filc/asn/asgt;=ref=filcfs/c=fmode" _ class="sreprivas_oprivata>;
 537ret
 href="+code=file" pplss="sref">pos> - fiocbuncatruncats"sliocb=err=fmode" _ class="sreki_os> -  538ret,
_s     f="+code=err" cclass="sref">le,
iov/atimespesa hre>ove=th=i_sb" clm/apquot="srov_le,
 539>inode *inode,
ceph_iclas" clasa href="+code=inode"class="sref">filc/asn/asgt;=ref=filcfs/c/file.c#L345" i5="L349" c5as6="line" n6me="L340"> 540ceph_inode_info *ci = ceph_inode(inode),
 541file
 href="+code=file" class="sref">baleiov/atimespesa hre>ove=th=i_sb" clm/apquot="srov_bale 542lf">ret,
_s     f="+code=err" cino >=ref="fs/ceph/file.c#L345" i5="L320" c5as6="line" n6me="L343"> 543 544i_t=huncatruncats"slef=h=dn"eph/file.c#L347" i5=5L303" c5as6="line" n6me="L345"> 545 546idout("atomicinv/a>dats" caioref=h 7du (ass=<\n&qx.s=<\n&qxss=<\n";to=an>Scephref=7du (a href="+code=errile.c#L347" i5=5L303" c5as6="line" n6me="L347"> 547i>inode),
pref="+codenti>inode),
le,
inode),
 548,
 549fi/asn/asgt;=ref=fifs/c=fmode" _ class="srefmeph_iclas" clasa hrm+code=fie=O_CREAT"DIRECTs="sra hefFILE_MODE_LAZYe),
 550),
),
 551 552),
 553 = il/a> = fgoent< clasa hra hgoede=c, -1/file.c#L288" i4="L284" c4as6="line" n6me="L254"> 554ret >= 0l&a 0 ef="fs/ceph/file.c#L345" i5="L315" c5as6="line" n6me="L255"> 555dout 556"atomicinv/a>dats" caioref=h 7du (ass=<\n&qx.s=<\n&qxss=<\n" 557i>inode),
pref="+codenti>inode),
le,
 558igoent< clasa hra hgoede=ch/file.c#L345" i5="L270" c5as6="line" n6me="L259"> 559 560goent< clasa hra hgoede=cede=err" cO_SYNCs="sref_ORDECAPfFILE_ a1)he),
),
 561i>ocbuncatruncats"sliocb=err=fmode" _ class="sreki_filc/asn/asgt;=ref=ki_filceph/=fmode" _ class="sref">flags & flags 562inode),
flags &  563fi/asn/asgt;=ref=fifs/c=fmode" _ class="srefflags &h|ref="+code=ce=O_CREAT"DIRECTs="sra hefFfflags 564/*
 565et = filc/asn/asgt;=ref=filcfs/cph_iCEPH_CAP_FILEbaleos> - ci 566 567i>ocbuncatruncats"sliocb=errf=_iclass="sref">iov/atimespesa hre>ove=thntryges" class="srr seags &  568 569out 570"atomicinv/a>dats" caioref=h 7du (ass=<\n&qx.s=<\n&qxsdro"+cod cep  clhref=7du (aeph=>,  571i>inode),
pref="+codenti>inode),
igoent< clasa hra hgoede=chis+inte" class="sref">et >=)ref="fs/ceph/file.c#L320" i5="L326" c5as6="line" n6me="L272"> 572l_vectora c hreffh_osfil/a> =  573 574rsref"eof_osf >= 0l&a 0 ef="fs/mod">ret >= 0l&a="L253" c5L26="line" n6me="L275"> 575 >= 0l&a de=eet;_attipeino;_do_>;_atti=dn" cllass="sref">i>inode),
 576 577/*
 578rde=eet >= 0l&a de=eetpos> - inode),
 >= 0l&a="L253" c5L26="line" n6me="L279"> 579"atomicinv/a>dats" caioref=h  afesef=h hit hole, fs/css=<\n&qde/cephi_trss=<\n&qd, ef=hcod fs/c href="+code=err"e" pplss="sref">pos> - inode),
 580et >=ref="fs/ceph/file.c#L345" i5="L320" c5as6="line" n6me="L281"> 581et >=ref="fs/ceph/file.c#L345" i5="L320" c5as6="line" n6me="L282"> 582,
et >=ref="fs/ceph/file.c#L345" i5="L320" c5as6="line" n6line" name=5me="L.c#L3006>&quo6;unhashun : rsref"eof_osf 484dagai,
 485 486 487et >= 0l&a 0 ef="fs/mod">reile.c#L300" i4="L349" c4as6="line" n6me="L288"> 488 >= 0l&a 0 ef="fsrph_iclass="sref">et=huncatruncats"slef=h=dn"file.c#L347" i5=5L303" c5as6="line" n6me="L289"> 489 490ret >=ref="fs/ceph/file.c#L345" i5="L320" c5as6="line" n6me="L291"> 491 492 493         * we mmmmmfs/ceph/file.c#L325" i5="L345" c5as6="line" n6me="L294"> 494 * If wen>
 495         * we mmmmmms/ceph/file.c#L325" i5="L345" c5as6="line" n6me="L296"> 496 * only rcora>)
t, unfIs we are  afehronous, andeginnr with  hreqde"fs/cf="fs/c,=the OSD/ceph/file.c#L325" i5="L345" c5as6="line" n6me="L297"> 497 */ 498 * If wen>
;tode enhcod "fs/cto=log/sally/ceph/file.c#L325" i5="L345" c5as6="line" n6me="L299"> 499 *
 500 * If wen>
 491/*
 492/*
 503,
_ss="sref">ret,
_s     f="+code=err" cinoovcovc<=err"es" class="sref"iov/atimespesa hre>ove=thiile.c#L300" i4="L349" c4as7="line" n7me="L294"> 504pos,  505 496 *file * 50745" _ceph_inode_info *fi/asn/asgt;=ref=fifs/cephs"lign" class="file * 508>inode *inode,
ceph_iclas" clasa href="+code=inode"class="sref">file * 499ass="sref">ceph_inode_info *ci = ceph_inode(inode),
 510client< clasa hra hrss="   e">cliee=ci" class="sref">cinum_paosdc 511ciclient< clasa hra hrss=" bora ">clie=inode" class="sref">inode),
client< clasa hra href="+code=i_layoosdcs="sref">num_paosdc 512lf">ret,
_s     f="+code=err" cinolen 513 514 515 516rss=" fsc/asn/asgt;=ref=rss=" fsc=inode" class="sref">inode),
 517 518 519mufs/_f="fpaGFP_NOFSfiinode),
 520 521 522leripeino, ov/atimespesa hre>ove=thnt=ci" clcass="sref">fnr seags & ci 523 524dout 525 526/*
 527inode 528 529eripeino, file *cios, ciinode),
 530 531dout 532 533reile.c#L300" i4="L349" c4as7="line" n7me="L334"> 534dout 535 536file * 537eripeino 538dout 539 540file * 541eripeino 542dout 543 544deftry" fsc/asn/asgt;=ref=eftry" fschreffile.c#L335" i5="L340" c5as7="line" n7me="L345"> 545num_paosdcnummsc/asn/asgt;=ref=nummsce=this_lges" class="s_ hefOSDMAPfFULLe),
 >= 0l&a="L253" c5L27="line" n7me="L346"> 546 547dout 548 549 550"atomicinv/a>dats" caiorginnr 7du (ass=<\n&qx.s=<\n&qxss=<\n"tcod ceps. asi_trss=<\n&qu href="+code=errile.c#L335" i5="L340" c5as7="line" n7me="L251"> 551i>inode),
pref="+codenti>inode),
l 552fi/asn/asgt;=ref=fifs/c=fmode" _ class="srefmeph_iclas" clasa hrm+code=fie=O_CREAT"DIRECTs="sra hefFILE_MODE_LAZYe),
 553 554 555 556 557;_vceph_osf;_vceph=dn" cllass="sref">il/a> = fgoent< clasa hra hgoede=c, _iCEPH_CAP_FILEos, l 558eripeino 559dout 560 561"atomicinv/a>dats" caiorginnr 7du (ass=<\n&qx.s=<\n&qxss=<\n" 562i>inode),
pref="+codenti>inode),
ligoent< clasa hra hgoede=chefile.c#L320" i5="L326" c5as7="line" n7me="L263"> 563 564goent< clasa hra hgoede=cede=err" cO_SYNCs="sref_ORDECAPfFILE_BUFFERe),
),
 565i>ocbuncatruncats"sliocb=err=fmode" _ class="sreki_filc/asn/asgt;=ref=ki_filceph/=fmode" _ class="sref">flags & flags 566inode),
flags &  567fi/asn/asgt;=ref=fifs/c=fmode" _ class="srefflags &h|ref="+code=ce=O_CREAT"DIRECTs="sra hefFfflags >= 0l&a="L253" c5L27="line" n7me="L268"> 568fiinode),
 569lenfile *i>ov/atimespesa hre>ove=th=i_sb" clm/apquot="srov_balel 570os - fiocbuncatruncats"sliocb=err=fmode" _ class="sreki_os> -  571 572leni>ocbuncatruncats"sliocb=errf=_iclass="sref">iov/atimespesa hre>ove=thntryges" class="srr seags &  >= 0l&a="L253" c5L27="line" n7me="L273"> 573os - fiocbuncatruncats"sliocb=err=fmode" _ class="sreki_os> -  574 575fiinode),
 576 577 578 579f">lenret >= 0l&a="L253" c5L27="line" n7me="L280"> 580( 581fl/a> = ;_f="fde=c/file.c#L288" i4="L284" c4as7="line" n7me="L282"> 582(;_mark_sirtyvceph_osf;_mark_sirtyvceph=dn" cllass="sref">il/a> = &quo7;unhashun : fl/a> = ;_f="fde=c/file.c#L288" i4="L284" c4as7="line" n7me="L284"> 484dirty( 485(i>inode),
 486 487 488("atomicinv/a>dats" caiorginnr 7du (ass=<\n&qx.s=<\n&qxss=<\n" 489i>inode),
pref="+codenti>inode),
iov/atimespesa hre>ove=th=i_sb" clm/apquot="srov_le,
 490igoent< clasa hra hgoede=chefile.c#L320" i5="L326" c5as7="line" n7me="L291"> 491il/a> =  492 493lenr =ci" e=O_Cile.c#L300" i4="L349" c4as7="line" n7me="L294"> 494file *file *inode 495num_paosdcnummsc/asn/asgt;=ref=nummsce=this_lges" class="s_ hefOSDMAPfNEARFULLe),
 >= 0l&a="L253" c5L27="line" n7me="L296"> 496file *ios, los, lf">len 497eripeino 498len 499 500 491f">len >= 0l&a="L253" c5L28=2line" n8me="L292"> 492("atomicinv/a>dats" caiorginnr 7du (ass=<\n&qx.s=<\n&qxss=<\n" 503i>inode),
pref="+codenti>inode),
iov/atimespesa hre>ove=th=i_sb" clm/apquot="srov_le,
 504fiinode),
 505 496deftry" fsc/asn/asgt;=ref=eftry" fschreffile.c#L345" i5="L280" c5as8=7line" n8me="L297"> 497 498 499heqd_mufs/ 510fiinode),
 511 512 513rf">lenrf">len 514 515 516 * only rcora>)
t, fs/ceph/file.c#L325" i5="L345" c5as8="line" n8me="L317"> 517 */ 518 * If wen>
 519,
_ss="sree>ret
 hrf="+code=file" plss="sref">p/a>;_flseeknt *file *p+cost >=ref="f+cost 520 >= 0l&a="L253" c5L28="line" n8me="L321"> 521>inode *inode,
inode 522 >=ref="fs/ceph/file.c#L345" i5="L320" c5as8="line" n8me="L323"> 523 524fiinode),
 525;_do_ enhcod_vme=cncanrpeino;_do_ enhcod_vme=cncanr=dn" cllass="sref">i>inode),
 526 527whence/a)rittlsgt;SEEK_END/a)rittlsgt;SEEK_DATA/a)rittlsgt;SEEK_HOLE/a)rittlsgt; >= 0l&a="L253" c5L28="line" n8me="L328"> 528 >= 0l&a 0 ef="fsph_osdc_rcopy;_attipeino;_do_>;_atti=dn" cllass="sref">i>inode),
 529et >= 0l&a 0 ef="fs/ceph/f/ >= 0l&a="L253" c5L28="line" n8me="L330"> 530 >=ref="fs/ceph/file.c#L345" i5="L320" c5as8="line" n8me="L331"> 531dout 532 533 534 535whence/a)rittlsgt; >= 0l&a="L253" c5L28=6line" n8me="L336"> 536SEEK_END/a)rittlsgt; 537>inode),
 538 539SEEK_CURe),
 540 * only rcora>)
t, fs/ceph/file.c#L325" i5="L345" c5as8="line" n8me="L341"> 541/*
 542/*
;toderef="+s   ref="+code=fmile.c#L325" i5="L345" c5as8="line" n8me="L343"> 543         * we mmmmm"""""""""""""""""* f_os< valur  cal"to;tode45" hbecauphha="+crurrlie ef=h(),code=fmile.c#L325" i5="L345" c5as8="line" n8me="L344"> 544 * If wen>
 545         * we mmmmmm""""""""""""""""*s/ceph/file.c#L327" i5="L268" c5as8="line" n8me="L346"> 546+cost >=ref="f+costret >= 0l&a="L253" c5L28="line" n8me="L347"> 547+cost >=ref="f+cost * 548dout 549 550 >=ref="f+costsref * 551 552SEEK_DATA/a)rittlsgt; 553+cost >=ref="f+cost_iclass="sref">>inode),
 >= 0l&a="L253" c5L28="line" n8me="L254"> 554 >= 0l&a 0 ef="fsph-_iCEPH_CAP_FILEENXIOe),
 555dout 556 557 558SEEK_HOLE/a)rittlsgt; 559+cost >=ref="f+cost_iclass="sref">>inode),
 >= 0l&a="L253" c5L28="line" n8me="L260"> 560),
 561dout 562 563inode),
 564 565 566 567 >=ref="f+cost, ifile *inode),
 &  568 569dout 570fiinode),
 571r+cost >=ref="f+cost 572 573 574, p/a>;_f5" _foph_osf >= 0l&a="L253" c5L28="line" n8me="L275"> 575r+pn >= 0l&a="L253" c5L28="line" n8me="L276"> 576rreleale >= 0l&a="L253" c5L28="line" n8me="L277"> 577rflseeknt >= 0l&a="L253" c5L28="line" n8me="L278"> 578rreahuncatruncats"slreah=dn"sph_osdc_rcopy >= 0l&a="L253" c5L28="line" n8me="L279"> 579rginnrpeino >= 0l&a="L253" c5L28="line" n8me="L280"> 580raiorreahuncatruncats"slaiorreah=dn"sph_osdc_rcopy >= 0l&a="L253" c5L28="line" n8me="L281"> 581 >= 0l&a="L253" cph_osdc_rcopynumaosdcnu_rcopmde"hr7fline"n/a> >= 0l&a="L253" cme="L272" >= 0l&a="L253" c8me="L273FP_NOFS;_f="fd8=c/fi8e.c#L288" i4="L253" c5L28="line"L270"> 570 570 >= 0l&a="L253" ch_osf( 570 570 >= 0l&a="L253" cn_to_+pn(raiorreahuncatruspliceef">r="+c    87f="+code=pos="fs/ceph_lgespliceef">raiorreahuncatru="fs/ceph_lgespliceef">rhr7fline"n/a> >= 0l&a="L253" celeale >= 0l&a="L253" c_flseeknt"> 487 51   87fed_ioct ="+c    87f="+code=pos". clioct n7me="L314"> 51". clioct ="+cline"n/a> >= 0l&a="L253" cesreahuncclhref=7du (a href="+cod8=fmoi88 >= 0l&a="L253" c5L28="lincompatlioct n7me="L314"> 51"ompatlioct >= 0   87f="+code=pos". clioct n7me="L314"> 51". clioct ="+cline"n/a> >= 0l&a="L253" ot="srov_8e,



The original LXR software by4 LXR c5auniode xr.asaux.no kindly