)]}'
{
  "commit": "ba5b65e4176d5e997775e9fd075199e805a6be13",
  "tree": "04dc14777306eca66cfbdab9bbf695b5cf140de3",
  "parents": [
    "1f19e7c5a062862552dacb891f240368865df4c5",
    "2aa071e58d7a290a61d8820da085e5253f22660a"
  ],
  "author": {
    "name": "David Howells",
    "email": "dhowells@redhat.com",
    "time": "Tue Mar 17 22:26:23 2015 +0000"
  },
  "committer": {
    "name": "David Howells",
    "email": "dhowells@redhat.com",
    "time": "Tue Mar 17 22:26:23 2015 +0000"
  },
  "message": "(Scripted) Merge in scripted non-filesystem -\u003ed_inode to d_backing_inode() conversions\n\nScripted merge in of scripted non-filesystem -\u003ed_inode to d_backing_inode() conversions\nusing the following perl script:\n\n#!/usr/bin/perl -w\nuse strict;\n\nopen(my $fd, \"\u003c$0\") || die $0;\nmy @script \u003d \u003c$fd\u003e;\nclose($fd);\n\nmy @file_system_types;\nopen(my $g, \u0027git grep -l \"struct file_system_type.*\u003d\" |\u0027) ||\n    die \"Can\u0027t grep for filesystem type\";\n@file_system_types \u003d \u003c$g\u003e;\nclose($g);\n\nmy @excludes \u003d (\n    \"fs/attr.c\",\n    \"fs/dcache.c\",\n    \"fs/exportfs/expfs.c\",\n    \"fs/file_table.c\",\n    \"fs/notify/\",\n    \"fs/locks.c\",\n    \"fs/namei.c\",\n    \"fs/namespace.c\",\n    \"fs/open.c\",\n    \"fs/overlayfs/\",\n    \"fs/utimes.c\",\n    \"fs/xattr.c\",\n    \"include/linux/\",\n    \"Documentation/filesystems/vfs.txt\",\n    );\n\nmy @treat_as_fs \u003d (\n    \"drivers/staging/lustre\",\n    \"fs/kernfs\",\n    \"fs/libfs.c\",\n    \"fs/quota/dquot.c\",\n    \"ipc\",\n    \"kernel/relay.c\",\n    \"kernel/trace\",\n    );\n\n###############################################################################\n#\n# Find the filesystems and classify them according to whether they occupy a\n# directory or a file in the source.\n#\n###############################################################################\nmy %fs_names \u003d ();\nmy %fs_dirs \u003d ();\nmy %fs_files \u003d ();\n\n# Miscellaneous convenience sets\nmy %fs_misc \u003d (\n#    \"arch\" \u003d\u003e [],\n#    \"drivers\" \u003d\u003e [],\n#    \"fs\" \u003d\u003e [],\n#    \"security\" \u003d\u003e []\n    );\n\nmy @fs_single \u003d ();\n\nfs_file: foreach my $file (@file_system_types) {\n    chomp $file;\n    foreach my $ex (@excludes, @treat_as_fs) {\n\tnext fs_file if (substr($file, 0, length($ex)) eq $ex);\n    }\n\n    # Handle whole-directory filesystems\n    if ($file \u003d~ m!^fs/([a-z0-9]+)/.*[.]c!) {\n\tmy $dir \u003d substr($file, 0, rindex($file, \"/\"));\n\tmy $name \u003d $1;\n\t$fs_names{$name} \u003d $dir;\n\t$fs_dirs{$dir} \u003d [];\n\tnext;\n    }\n\n    #next if ($file \u003d~ m!^drivers/staging/lustre!);\n\n    # Handle single-file filesystems\n    $fs_files{$file} \u003d [];\n}\n\nforeach my $path (@treat_as_fs) {\n    if ($path \u003d~ /[.][ch]/) {\n\t$fs_files{$path} \u003d [];\n    } else {\n\tmy $name \u003d substr($path, rindex($path, \"/\") + 1);\n\t$fs_names{$name} \u003d $path;\n\t$fs_dirs{$path} \u003d [];\n    }\n}\n\nmy @to_fs_inode \u003d sort(keys(%fs_dirs));\n\n###############################################################################\n#\n# Find all occurrences of files containing \"-\u003ed_inode\" and divide them amongst\n# the various filesystems and non-filesystems.\n#\n###############################################################################\nmy @occurrences;\nopen($g, \u0027git grep -l \"[-]\u003ed_inode\" |\u0027) ||\n    die \"Can\u0027t grep for -\u003ed_inode\";\n@occurrences \u003d \u003c$g\u003e;\nclose($g);\n\nmy %non_fs \u003d ();\n\nfile: foreach my $file (@occurrences) {\n    chomp $file;\n    foreach my $ex (@excludes) {\n\tnext file if (substr($file, 0, length($ex)) eq $ex);\n    }\n\n    foreach my $path (@to_fs_inode) {\n\tif (index($file, $path) \u003d\u003d 0) {\n\t    #print $file, \" found in \", $path, \"\\n\";\n\t    push @{$fs_dirs{$path}}, $file;\n\t    next file;\n\t}\n    }\n\n    if (exists($fs_files{$file})) {\n\tforeach my $path (keys(%fs_misc)) {\n\t    if (index($file, $path) \u003d\u003d 0) {\n\t\tpush @{$fs_misc{$path}}, $file;\n\t\tdelete $fs_files{$file};\n\t\tnext file;\n\t    }\n\t}\n    }\n\n    if (exists($fs_files{$file})) {\n\tpush @{$fs_files{$file}}, $file;\n\tnext file;\n    }\n\n    if ($file \u003d~ m!include/trace/events/([_a-zA-Z0-9]+)[.]h!) {\n\tmy $fs \u003d $1;\n\tif (exists($fs_names{$fs})) {\n\t    push @{$fs_dirs{$fs_names{$fs}}}, $file;\n\t    next;\n\t}\n    }\n\n    #print $file, \" not found\\n\";\n    $non_fs{$file} \u003d [ $file ];\n}\n\nforeach my $path (sort(keys(%fs_files))) {\n    push @fs_single, @{$fs_files{$path}};\n}\n\n###############################################################################\n#\n# Summarise how the filesystem file sets will be split up\n#\n###############################################################################\nmy $summarise \u003d 0;\nif ($summarise) {\n    foreach my $path (sort(keys(%fs_dirs))) {\n\tprint $path, \":\\n\";\n\tforeach my $file (@{$fs_dirs{$path}}) {\n\t    print \"\\t\", $file, \"\\n\";\n\t}\n    }\n\n    foreach my $path (sort(keys(%fs_misc))) {\n\tprint $path, \"-single-fs:\\n\";\n\tforeach my $file (@{$fs_misc{$path}}) {\n\t    print \"\\t\", $file, \"\\n\";\n\t}\n    }\n\n    print \"single-fs:\\n\";\n    foreach my $path (sort(keys(%fs_files))) {\n\tforeach my $file (@{$fs_files{$path}}) {\n\t    print \"\\t\", $file, \"\\n\";\n\t}\n    }\n\n    print \"non-filesystem:\\n\";\n    foreach my $path (sort(keys(%non_fs))) {\n\tforeach my $file (@{$non_fs{$path}}) {\n\t    print \"\\t\", $file, \"\\n\";\n\t}\n    }\n\n    print \"\\n\";\n}\n\n###############################################################################\n#\n# Group the non-filesystems by directories with two or more files that need\n# changing.\n#\n###############################################################################\nmy %non_groups \u003d ();\nmy %non_dirs \u003d ();\n\nforeach my $file (keys(%non_fs)) {\n    my $p \u003d index($file, \"/\");\n    my $q \u003d index($file, \"/\", $p + 1);\n    $p \u003d $q if ($q !\u003d -1);\n    my $dir \u003d substr($file, 0, $p);\n    $non_dirs{$dir} \u003d 0 unless exists $non_dirs{$dir};\n    $non_dirs{$dir}++;\n    $non_groups{$dir} \u003d [] unless exists $non_groups{$dir};\n    push @{$non_groups{$dir}}, $file;\n}\n\nforeach my $dir (sort(keys(%non_dirs))) {\n    #print $dir, \" -\u003e \", $non_dirs{$dir}, \"\\n\";\n    if ($non_dirs{$dir} \u003d\u003d 1) {\n\tmy $p \u003d index($dir, \"/\");\n\tif ($p !\u003d -1) {\n\t    my $top \u003d substr($dir, 0, $p);\n\t    $non_dirs{$top} \u003d 0 unless exists $non_dirs{$top};\n\t    $non_dirs{$top}++;\n\t    $non_groups{$top} \u003d [] unless exists $non_groups{$top};\n\t    push @{$non_groups{$top}}, @{$non_groups{$dir}};\n\t    delete $non_dirs{$dir};\n\t}\n    }\n}\n\n#foreach my $dir (sort(keys(%non_dirs))) {\n#    print \"Non-filesystem \", $dir, \":\\n\";\n#    foreach my $file (@{$non_groups{$dir}}) {\n#\tprint \"\\t\", $file, \"\\n\";\n#    }\n#}\n\n###############################################################################\n#\n# Set up the integration branch\n#\n###############################################################################\nsystem(\"git\", \"checkout\", \"file-pin\") \u003d\u003d 0 || die;\ndie if `stg branch` ne \"file-pin\\n\";\nsystem(\"git\", \"reset\", \"--hard\", \"file-pin-devel\") \u003d\u003d 0 || die;\n\n###############################################################################\n#\n# Fabricate commits for d_inode -\u003e d_inode() conversion\n#\n###############################################################################\nsystem(\"git\", \"checkout\", \"file-pin-fs-experimental\") \u003d\u003d 0 || die;\ndie if `stg branch` ne \"file-pin-fs-experimental\\n\";\nsystem(\"git\", \"reset\", \"--hard\", \"file-pin\") \u003d\u003d 0 || die;\n\nsub convert_to_d_inode($$)\n{\n    my ($title, $files) \u003d @_;\n\n    unless (@{$files}) {\n\tprint \"Skipping $title with no files\\n\";\n\treturn;\n    }\n\n    print \"Process $title\\n\";\n\n    my $dir \u003d $files-\u003e[0];\n    $dir \u003d~ s![^/]+$!!;\n    $dir \u003d~ s!/$!!;\n    $dir \u003d~ s!/!_!g;\n\n    foreach my $file (@{$files}) {\n\topen(my $fd, \"\u003c$file\") || die $file;\n\tmy @lines \u003d \u003c$fd\u003e;\n\tclose($fd);\n\n\tmy @out \u003d map {\n\t    # Convert -\u003ed_inode to d_inode[_rcu]()\n\t    s!ACCESS_ONCE[(](([_a-zA-Z][_a-zA-Z0-9]*(-\u003e|[.]))*[_a-zA-Z][_a-zA-Z0-9]*)-\u003ed_inode[)]!d_inode_rcu($1)!g;\n\t    s!(([_a-zA-Z][_a-zA-Z0-9]*(-\u003e|[.]))*[_a-zA-Z][_a-zA-Z0-9]*)-\u003ed_inode!d_inode($1)!g;\n\n\t    # Convert some d_inode() to d_really_is_xxx()\n\t    s!(if\\s*[(].*)\\bd_inode[(]([a-z_A-Z0-9-\u003e.]+)[)] \u003d\u003d NULL!$1d_really_is_negative($2)!g;\n\t    s/(if\\s*[(].*)\\bd_inode[(]([a-z_A-Z0-9-\u003e.]+)[)] !\u003d NULL/$1d_really_is_positive($2)/g;\n\t    s/(if\\s*[(])!d_inode[(]([a-z_A-Z0-9-\u003e.]+)[)][)]/$1d_really_is_negative($2))/g;\n\t    s/(if\\s*[(])d_inode[(]([a-z_A-Z0-9-\u003e.]+)[)][)]/$1d_really_is_positive($2))/g;\n\t    s/(if\\s*[(].*)!d_inode[(]([a-z_A-Z0-9-\u003e.]+)[)][)]$/$1d_really_is_negative($2))/g;\n\t    s/(if\\s*[(].*)\\bd_inode[(]([a-z_A-Z0-9-\u003e.]+)[)][)]$/$1d_really_is_positive($2))/g;\n\t    s/(if\\s*[(].*)!d_inode[(]([a-z_A-Z0-9-\u003e.]+)[)][)] [{]$/$1d_really_is_negative($2)) {/g;\n\t    s/(if\\s*[(].*)\\bd_inode[(]([a-z_A-Z0-9-\u003e.]+)[)][)] [{]$/$1d_really_is_positive($2)) {/g;\n\t    s/!d_inode[(]([a-z_A-Z0-9-\u003e.]+)[)]\\s*([\u0026][\u0026]|[|][|])/d_really_is_negative($1) $2/g;\n\t    s/([^a-z_0-9A-Z])d_inode[(]([a-z_A-Z0-9-\u003e.]+)[)]\\s*([\u0026][\u0026]|[|][|])/$1d_really_is_positive($2) $3/g;\n\n\t    # Handle cases of \u003d\u003d or !\u003d d_inode() getting converted incorrectly\n\t    s/([\u003d!]\u003d\\s*)d_really_is_positive/$1d_inode/g;\n\t} @lines;\n\n\topen($fd, \"\u003e$file\") || die $file;\n\tprint $fd @lines;\n\tclose($fd) || die $file;\n    }\n\n    system(\"git\", \"add\", @{$files}) \u003d\u003d 0 || die;\n    system(\"git\", \"commit\", \"-m\",\n\t   \"VFS: (Scripted) Convert -\u003ed_inode to d_inode() $title\\n\" .\n\t   \"\\n\" .\n\t   \u0027Signed-off-by: David Howells \u003cdhowells@redhat.com\u003e\u0027) \u003d\u003d 0 || die;\n}\n\nforeach my $fs (sort(keys(%fs_dirs))) {\n    convert_to_d_inode(\"in $fs/\", $fs_dirs{$fs});\n}\n\nforeach my $fs (sort(keys(%fs_misc))) {\n    convert_to_d_inode(\"in $fs/\", $fs_misc{$fs});\n}\n\n#convert_to_fs_inode(\"miscellany\", \\@fs_single);\nforeach my $file (sort(@fs_single)) {\n    convert_to_d_inode(\"in $file\", [$file]);\n}\n\n# Merge the changes back into the integration branch, noting the script in the\n# merge message.\nmy @msg \u003d (\n    \"(Scripted) Merge in scripted filesystem -\u003ed_inode to d_inode() conversions\\n\",\n    \"\\n\",\n    \"Scripted merge in of scripted filesystem -\u003ed_inode to d_inode() conversions\\n\",\n    \"using the following perl script:\\n\",\n    \"\\n\",\n    @script,\n    \"\\n\",\n    \u0027Signed-off-by: David Howells \u003cdhowells@redhat.com\u003e\u0027);\n\nsystem(\"git\", \"checkout\", \"file-pin\") \u003d\u003d 0 || die;\ndie if `stg branch` ne \"file-pin\\n\";\nsystem(\"git\", \"merge\", \"--no-ff\", \"file-pin-fs-experimental\", \"-m\", join(\"\", @msg));\n\n###############################################################################\n#\n# Fabricate an stg commit for d_inode -\u003e d_backing_inode() conversion\n#\n###############################################################################\nsystem(\"git\", \"checkout\", \"file-pin-nonfs-experimental\") \u003d\u003d 0 || die;\ndie if `stg branch` ne \"file-pin-nonfs-experimental\\n\";\nsystem(\"git\", \"reset\", \"--hard\", \"file-pin\") \u003d\u003d 0 || die;\n\nsub convert_to_d_backing_inode($$)\n{\n    my ($title, $files) \u003d @_;\n\n    unless (@{$files}) {\n\tprint \"Skipping $title with no files\\n\";\n\treturn;\n    }\n\n    print \"Process $title\\n\";\n\n    my $dir \u003d $files-\u003e[0];\n    $dir \u003d~ s![^/]+$!!;\n    $dir \u003d~ s!/$!!;\n    $dir \u003d~ s!/!_!g;\n\n    foreach my $file (@{$files}) {\n\topen(my $fd, \"\u003c$file\") || die $file;\n\tmy @lines \u003d \u003c$fd\u003e;\n\tclose($fd);\n\n\tmy @out \u003d map {\n\t    # Convert -\u003ed_inode to d_inode[_rcu]()\n\t    s!ACCESS_ONCE[(](([_a-zA-Z][_a-zA-Z0-9]*(-\u003e|[.]))*[_a-zA-Z][_a-zA-Z0-9]*)-\u003ed_inode[)]!d_backing_inode_rcu($1)!g;\n\t    s!(([_a-zA-Z][_a-zA-Z0-9]*(-\u003e|[.]))*[_a-zA-Z][_a-zA-Z0-9]*)-\u003ed_inode!d_backing_inode($1)!g;\n\t    # Convert some d_inode() to d_is_xxx()\n\t    s!(if\\s*[(].*)\\bd_backing_inode[(]([a-z_A-Z0-9-\u003e.]+)[)] \u003d\u003d NULL!$1d_is_negative($2)!g;\n\t    s/(if\\s*[(].*)\\bd_backing_inode[(]([a-z_A-Z0-9-\u003e.]+)[)] !\u003d NULL/$1d_is_positive($2)/g;\n\t    s/(if\\s*[(])!d_backing_inode[(]([a-z_A-Z0-9-\u003e.]+)[)][)]/$1d_is_negative($2))/g;\n\t    s/(if\\s*[(])d_backing_inode[(]([a-z_A-Z0-9-\u003e.]+)[)][)]/$1d_is_positive($2))/g;\n\t    s/(if\\s*[(].*)!d_backing_inode[(]([a-z_A-Z0-9-\u003e.]+)[)][)]$/$1d_is_negative($2))/g;\n\t    s/(if\\s*[(].*)\\bd_backing_inode[(]([a-z_A-Z0-9-\u003e.]+)[)][)]$/$1d_is_positive($2))/g;\n\t    s/(if\\s*[(].*)!d_backing_inode[(]([a-z_A-Z0-9-\u003e.]+)[)][)] [{]$/$1d_is_negative($2)) {/g;\n\t    s/(if\\s*[(].*)\\bd_backing_inode[(]([a-z_A-Z0-9-\u003e.]+)[)][)] [{]$/$1d_is_positive($2)) {/g;\n\t    s/!d_backing_inode[(]([a-z_A-Z0-9-\u003e.]+)[)]\\s*([\u0026][\u0026]|[|][|])/d_is_negative($1) $2/g;\n\t    s/([^a-z_0-9A-Z])d_backing_inode[(]([a-z_A-Z0-9-\u003e.]+)[)]\\s*([\u0026][\u0026]|[|][|])/$1d_is_positive($2) $3/g;\n\t} @lines;\n\n\topen($fd, \"\u003e$file\") || die $file;\n\tprint $fd @lines;\n\tclose($fd) || die $file;\n    }\n\n    system(\"git\", \"add\", @{$files}) \u003d\u003d 0 || die;\n    system(\"git\", \"commit\", \"-m\",\n\t   \"VFS: (Scripted) Convert -\u003ed_inode to d_backing_inode() $title\\n\" .\n\t   \"\\n\" .\n\t   \u0027Signed-off-by: David Howells \u003cdhowells@redhat.com\u003e\u0027) \u003d\u003d 0 || die;\n}\n\nforeach my $dir (sort(keys(%non_dirs))) {\n    convert_to_d_backing_inode(\"in $dir\", $non_groups{$dir});\n}\n\n# Merge the changes back into the integration branch, noting the script in the\n# merge message.\n@msg \u003d (\n    \"(Scripted) Merge in scripted non-filesystem -\u003ed_inode to d_backing_inode() conversions\\n\",\n    \"\\n\",\n    \"Scripted merge in of scripted non-filesystem -\u003ed_inode to d_backing_inode() conversions\\n\",\n    \"using the following perl script:\\n\",\n    \"\\n\",\n    @script,\n    \"\\n\",\n    \u0027Signed-off-by: David Howells \u003cdhowells@redhat.com\u003e\u0027);\n\nsystem(\"git\", \"checkout\", \"file-pin\") \u003d\u003d 0 || die;\ndie if `stg branch` ne \"file-pin\\n\";\nsystem(\"git\", \"merge\", \"--no-ff\", \"file-pin-nonfs-experimental\", \"-m\", join(\"\", @msg));\n\nSigned-off-by: David Howells \u003cdhowells@redhat.com\u003e\n",
  "tree_diff": []
}
